-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
I have an object array in my document and i want to update them all but mongo update only the first one matching to the update condition
for example I have a doc :
{ "_id" : ObjectId("590aee020a0556027b14b262"), "x" : [ { "y" : 1 }, { "y" : 1 }, { "y" : 1 }, { "y" : 1 } ] }
Now I am updating this :-
db.users.update({"x.y":1},{$set:{"x.$.y":2}},{multi:true})
then only get the first object updated :-
{ "_id" : ObjectId("590aee020a0556027b14b262"), "x" : [ { "y" : 2 }, { "y" : 1 }, { "y" : 1 }, { "y" : 1 } ] }
- duplicates
-
SERVER-1243 New operator to update all matching items in an array
- Closed