|
In addition to the changes described by this ticket, we also need to make sure that $isolated/$atomic are illegal inside arrayFilters. For details on the new array update behavior added during development of the 3.6 stable release, see https://docs.mongodb.com/master/reference/operator/update/positional-all/#positional-update-all. Here is an example of an update that should fail due to an illegal $isolated, but instead succeeds:
> db.c.drop()
|
true
|
> db.c.insert({a: [1, 2, 3]})
|
WriteResult({ "nInserted" : 1 })
|
> db.c.update({}, {$set: {"a.$[i]": 99}}, {arrayFilters: [{i: 2, $isolated: true}]})
|
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
|
> db.c.find()
|
{ "_id" : ObjectId("59c017ff4c4b0d6b6dd0fd8a"), "a" : [ 1, 99, 3 ] }
|
blake.oler, I think we can fix this by adding kIsolated to the list of "special features" which callers of the MatchExpressionParser must explicitly enable:
https://github.com/mongodb/mongo/blob/5be92f19e87b9dc06c5ebde9ebe9f19538f1af84/src/mongo/db/matcher/expression_parser.h#L91-L102
CC tess.avitabile
|