Model.bulkWrite fails embedded array update with embedded discriminator and arrayFilters #14978
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
8.7.2
Node.js version
20.18.0
MongoDB server version
8.0.1
Typescript version (if applicable)
No response
Description
When updating an embedded document array with an embedded schema discriminator and filtered positional operator, the operation succeeds when done with Model.updateOne() but throws the following error when the same operation is done by calling Model.bulkWrite():
MongoInvalidArgumentError: Update document requires atomic operators
Steps to Reproduce
In the following script, update will fail with a MongoInvalidArgumentError:
However, if the call to bulkWrite() is replaced with updateOne() the operation will succeed:
Expected Behavior
An update to an embedded array with an embedded schema discriminator should succeed with Model.bulkWrite(), as the same request does when done with Model.updateOne().
The text was updated successfully, but these errors were encountered: