mongoose icon indicating copy to clipboard operation
mongoose copied to clipboard

r.find(...).arrayFilters is not a function in bulk operation

Open cassiolacerda opened this issue 6 years ago • 1 comments

Do you want to request a feature or report a bug? bug

What is the current behavior?

When I try using Mongo bulk in Mongoose, the first one run runs normally. However, the second one returns: r.find(...).arrayFilters is not a function

If the current behavior is a bug, please provide the steps to reproduce.

const bulk = Account.collection.initializeOrderedBulkOp(); bulk.find({ "users._id": event.pathParameters.id }).updateOne({ $unset: { "users.$.adm.segments.$[].default": true }, }); bulk .find({ "users._id": event.pathParameters.id }) .arrayFilters([ { "i._id": event.body.data.adm.segments[0]._id, }, ]) .updateOne({ $set: { "users.$.adm.segments.$[i].default": true, }, }); return bulk.execute();

What is the expected behavior?

In the MongoDb official doc (https://docs.mongodb.com/manual/reference/method/Bulk.find.arrayFilters/), says 3.6 version already is supported, but not reflects in Mongoose model query.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version. Node: v12.16.1 Mongoose: v5.10.3 MongoDB : v3.6.1

cassiolacerda avatar Sep 07 '20 18:09 cassiolacerda

That's the MongoDB shell docs, not the MongoDB driver documentation. The MongoDB driver doesn't support this syntax.

vkarpov15 avatar Sep 08 '20 19:09 vkarpov15