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
When updating a subdocument with javascript and save(), the behaviour is different from dispatching an equivalent $set operation.
Notably this is relevant for timestamps on subdocuments.
If the current behavior is a bug, please provide the steps to reproduce.
The following test case demonstrates the issue observed.
Confirmed. It looks like the cause of this issue is that, because subdocument isNew is the same as parent isNew after #7048, schema timestamps aren't working correctly for subdocuments. We're working on a fix and should have a fix released within the next couple of days.
What is the current behavior?
When updating a subdocument with javascript and
save()
, the behaviour is different from dispatching an equivalent$set
operation.Notably this is relevant for timestamps on subdocuments.
If the current behavior is a bug, please provide the steps to reproduce.
The following test case demonstrates the issue observed.
What is the expected behavior?
Both test cases should pass, yet only the explicit
$set
behaves as expected.What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
I observed the behaviour after updating to version 6.2.9 from previously 5.11.2. In the 5.x version, this worked as expected.
The text was updated successfully, but these errors were encountered: