[SERVER-29065] multiple object update in array field Created: 04/May/17  Updated: 04/May/17  Resolved: 04/May/17

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Mayank Tyagi Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-1243 New operator to update all matching i... Closed
Participants:

 Description   

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 } ] }



 Comments   
Comment by Kelsey Schubert [ 04/May/17 ]

Hi mayanktyagi1992,

Thanks for the feature request. This is a duplicate of SERVER-1243, please feel free to vote for SERVER-1243 and watch it for updates.

Kind regards,
Thomas

Generated at Thu Feb 08 04:19:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.