-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Minor - P4
-
None
-
Affects Version/s: 2.2.2
-
Component/s: MongoDB 3.4
-
Environment:Mac OS X 10.12
Mongo 3.4
Node 6.9.2
Node Driver 2.2.16
-
Empty show more show less
Example document:
{ _id: ObjectId("123"), array: [ { _id: ObjectId("456") } ] }
The following query doesn't work:
let find = {_id: new ObjectID("123")}; let update = {$pull: {'array._id': new ObjectID("456")}}; collection.updateMany(find, update);
The output is: cannot use the part (array of array._id) to traverse the element
If we change the update query to:
let update = {$pull: {array: {_id: new ObjectID("456")};}}
Everything works as expected.