You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.
We have a collection which is configured with the history plugin and it works fine. However if I also embed the schema in another collection which also has the history plugin setup, then mongoose-history throws an error on save
TypeError: Cannot read property 'name' of undefined
at Document.<anonymous> (/xxx/app-name/node_modules/mongoose-history/lib/mongoose-history.js:31:79)
Basically, the save hook thinks that the subdocument also needs to be saved but it is part of a bigger document that has the history plugin setup.
One possible fix could be to check for this.collection before trying to actually save.
The text was updated successfully, but these errors were encountered:
Hi,
We have a collection which is configured with the history plugin and it works fine. However if I also embed the schema in another collection which also has the history plugin setup, then mongoose-history throws an error on save
Basically, the save hook thinks that the subdocument also needs to be saved but it is part of a bigger document that has the history plugin setup.
One possible fix could be to check for
this.collection
before trying to actually save.The text was updated successfully, but these errors were encountered: