-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.2.3
-
Component/s: Querying
-
None
-
ALL
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Consider the following example:
db.getCollection("test").insert({ "_id" : 5, "scopes" : [ "a", "b" ], "tags" : [ { "name" : "abc", "id" : 1 }, { "name" : "def", "id" : 2 } ] }) db.getCollection('test').update({ "_id" : 5, "scopes" : { "$in" : ["a"]}, "tags.id" : 2 }, { "$set" : { "tags.$.name" : "ghi"} })
This example changes the first tag name abc to ghi instead of the desired behavior of changing the tag with name def to ghi.
I think the $in operator is setting the positional operator $, because if we change the query for "scopes" :
{ "$in" : ["b"]}, then the second tag is getting updated...