-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
5.9.28 reset fields in edge case #9313
Comments
You're right, I can reproduce it too in mongoose 5.9.28. I'm curious how it happens, will try to take a look... |
Yeah the conditions to replicate it are pretty strange, I'm not sure why it's happening but looking at the changes in 5.9.28 it should be due to these lines 5.9.27...5.9.28#diff-e51f9847487dfe7cf44f998bf9b8b8e8R141 |
That link doesn't work for me... |
5.9.27...5.9.28 the changes for |
Very likely you're right. For reference that commit mentions #9293 |
I've cooked it down to remove lodash from the equation. Essentially this is what lodash is doing as part of its algorithm, it seems. Just assigning the "nested" field to itself makes it disappear...
|
This, however, works:
but this does not:
That tells me the other hidden $-properies mongoose adds are tripping it up, and the logic for them is flawed with the version 28 addition, just as you said. |
We got the same problem here, we had to revert back to a previous Mongoose version. |
Same issue here... |
Thanks for reporting this issue. Bug is fixed and fix will be in 5.9.29 👍 |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Using lodash's
set
method (https://lodash.com/docs/4.17.15#set) to set a nested property is resulting in all the other properties of the nested object to be set to undefined.If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
The properties are set correctly. Note that for some strange reason removing
prop3
from the schema the bug doesn't appear. It looks like it only happens when there are at least 3 nested properties.What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
It started happening in 5.9.28, 5.9.27 works fine. On node 12
The text was updated successfully, but these errors were encountered: