mongoDB & MySQL hybrid configuration correct insert audits but return empty $model->audits #795
Unanswered
victorioustr
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Actual Behaviour
mongoDB & MySQL hybrid is used. The model table is in MySQL, the audits collection is also in the mongoDB database.
When Hybrid connection is made with mongoDB, it adds the audit record to the collection. But when $mode->audits request is made, it returns empty.
Expected Behaviour
In the query sent to mongoDb as a result of the debug, it adds the table name in the filter fields.
Steps to Reproduce
I made the settings by following the http://www.laravel-auditing.com/docs/master/audit-implementation address. Below you can see an example of mongoDB query.
audits.find({"$and": [{"audits.auditable_id": 1}, {"audits.auditable_id": {"$ne": null}}, {"audits.auditable_type": "App\\Models\\Company"}]})
Possible Solutions
It is enough to remove the collection name at the beginning of the fields added to the find query.
Beta Was this translation helpful? Give feedback.
All reactions