-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.4.1
-
Component/s: Querying
-
None
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I have next document:
{
"_id" : ObjectId("58821b8100e83a84ae110fbd"),
"a" : [ { "id" : 4, "group" : "a", "k" : "v1" },
{ "id" : 4, "group" : "b", "k" : "v2" } ]
}
and I want to replace 'v2' by 'v_new' using $set and $and in the query:
update({$and: [{'a.group': 'b'}, {'a.id': 4}] }, {'$set': {'a.$.k': 'v_new'} })
But it replaces 'v1' by 'v_new' ($ refers to wrong element of array 'a').