I want to make an update query for multiple subdocuments at once. I will be setting all the subdocuments statuses to passive where they satisfy the condition I give on query. <
I have run below query. And it is working fantastic.
db.mm.update( { $or: [ {$and: [{"_id": ObjectId("581d18d41b6c5c752f11c87a")}] },
{$and: [{"_id": ObjectId("581a1a671b6c5c752f11c87b")}] }
]
}, {$set : {"name": "abc3"}});
If first document not found , second one is updated. And if 1st one is found it is updating only 1st one.
You can see that in your question -> Error message it is showing "nMatched" : 0
. It is not finding any documents. Confirm all ID's and reference ID's.