Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add ignoreAtomics option to isModified() for better backwards compatibility with Mongoose 5 #14213

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

vkarpov15
Copy link
Collaborator

Re: #14024

Summary

Some of the work we did to make isModified() more consistent with what paths Mongoose validates and sends to MongoDB caused some trouble for users, so this PR adds a ignoreAtomics option to isModified() that can help smooth out the issues. Basically, with this ignoreAtomics option, isModified() will return false if passed an array path where the top-level array has a non-$set atomic operator. So if post.comments has a $push and no $set, then post.isModified('comments.0.title', { ignoreAtomics: true }) will return false.

Examples

@heyfirst
Copy link

heyfirst commented Jan 3, 2024

hey @vkarpov15, thanks for promptly raise the PR for providing backward-compatibility option! We tested in our use-case and it works! Looking forward for this to be in release,

Also, another way if you want to release this one as canary like v6.12.4.14024 it's also works as well, we will able to install and try with our codebase 🙂

Our test we used to test it Screenshot 2024-01-03 at 17 18 56

@vkarpov15 vkarpov15 merged commit b4e3b2f into 6.x Jan 3, 2024
37 checks passed
@vkarpov15 vkarpov15 added this to the 6.12.5 milestone Jan 3, 2024
@hasezoey hasezoey deleted the vkarpov15/gh-14024 branch January 3, 2024 22:07
@vkarpov15
Copy link
Collaborator Author

@heyfirst we shipped 6.12.5 yesterday with the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants