-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.10, 3.6.0-rc4
-
Query Optimization
-
ALL
In the query language, when a numerical path component is used to select an element of an array, elements are only selected if the numerical path component matches their exact fieldname:
> db.c.insert({_id: 0, a: [0]}) WriteResult({ "nInserted" : 1 }) > db.c.find({"a.00": 0}) > db.c.find({"a.0": 0}) { "_id" : 0, "a" : [ 0 ] }
In the update language, a numerical path components is parsed as an unsigned base 10 integer n, and we select the nth array element:
> db.c.insert({_id: 0, a: [0]}) WriteResult({ "nInserted" : 1 }) > db.c.update({_id: 0}, {$set: {"a.00": 1}}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) > db.c.find() { "_id" : 0, "a" : [ 1 ] }