-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.6.0, 4.0.0
-
Environment:Windows NodeJS
Mongodb Manual Reference has provided below example:
var bulk = db.coll.initializeUnorderedBulkOp(); bulk.find({}).arrayFilters( [ { "elem.grade": { $gt: 85 } } ] ).updateOne( { $set: { "grades.$[elem].mean" : 70 } } ); bulk.execute();
When executing this function in node.js with mongodb npm, its giving an error,
TypeError: bulk.find(...).arrayFilters is not a function at updateDocuments (path\index.js:21:14) at processTicksAndRejections (internal/process/task_queues.js:93:5)
Note: its working successful in mongo shell
Mongodb Version: 4.2
Mongodb NPM: 3.6.0
Node JS: 12.x
As per last fix NODE-1911,
It is working this way.
db.coll.updateOne( {}, { $set: { "grades.$[elem].mean" : 70 } }, { arrayFilters: [ { "elem.grade": { $gt: 85 } } ] } );
- has to be done before
-
MONGOSH-327 Implement arrayFilters for bulk API
- Closed
- is depended on by
-
MONGOSH-467 Update driver to 4.0
- Closed
- is related to
-
NODE-2734 Consider making the bulk API fluid
- Closed