Repro:
db.test.insert({"x" : []}); db.test.update({}, {$max: {"x.2.a": 1, "x.2.b": 1}}); // 3.4: { "x" : [ null, null, { "a" : 1, "b" : 1 } ] } // 3.6: { "x" : [ null, null, { "a" : 1 }, { "b" : 1 } ] }
The behavior on 3.6 gives the appearance that a different array element than the one specified was modified. In this case, the 3rd instead of the 2nd.
The behavior on 3.4 seems to be correct.
- is related to
-
SERVER-31821 Update operator $min handles non-existent array elements differently in 3.6
- Closed