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
doc.modifiedPaths() returns that paths have been modified (even if they didn't) on models that have nested schemas. What is also interesting: it works completely fine when i don't do type: ChildSchema and just embed the schema inline.
If the current behavior is a bug, please provide the steps to reproduce.
It would be a lot less confusing if both examples would behave the same.
Please mention your node.js, mongoose and MongoDB version.
Node.js: 10.9.0
Mongoose: 5.2.17
Additional info
Is there any workaround for this issue? Can I somehow manually check for equality on a saved document? schema.pre('validate', () => {}) gives me only access to the already changed document, which is already a bummer. Any ideas?
The text was updated successfully, but these errors were encountered:
Thanks for reporting, will look into this ASAP. As a workaround, you can use a deep equality check like lodash.deepEquals(), just make sure you call toObject() on both documents that you're comparing.
Do you want to request a feature or report a bug?
A bug, I guess.
What is the current behavior?
doc.modifiedPaths()
returns that paths have been modified (even if they didn't) on models that have nested schemas. What is also interesting: it works completely fine when i don't dotype: ChildSchema
and just embed the schema inline.If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
It would be a lot less confusing if both examples would behave the same.
Please mention your node.js, mongoose and MongoDB version.
Additional info
Is there any workaround for this issue? Can I somehow manually check for equality on a saved document?
schema.pre('validate', () => {})
gives me only access to the already changed document, which is already a bummer. Any ideas?The text was updated successfully, but these errors were encountered: