When saving a model with bulkSave, the values in the discriminator schema are not updated. #13907
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
7.5.3
Node.js version
18.16.0
MongoDB server version
6.0.10
Typescript version (if applicable)
5.2.2
Description
When saving a model with bulkSave, the properties of the discriminator schema are not updated.
When I try the same update with model.prototype.save, it is updated, so is this a bug with bulkSave?
I followed the internal process of bulkSave in the debugger, and it looks like updates to paths that are not in the base schema (updates to the discriminator schema) are deleted in the walkUpdatePath function in castUpdate.js.
Steps to Reproduce
Test code that can reproduce the problem
Expected Behavior
bulkSave also updates the properties of the discriminator in the same way as save.
The text was updated successfully, but these errors were encountered: