-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Query Language
-
Query Optimization
> db.blah.insert({a: 'not 3'}) WriteResult({ "nInserted" : 1 }) > db.blah.insert({a: ['not 3', 3]}) WriteResult({ "nInserted" : 1 }) > db.blah.find({a: {$ne: 3}}) { "_id" : ObjectId("60634e127cc9a947848c101a"), "a" : "not 3" }
Under the normal rules for arrays, both documents should match, since they each have at least one element in a that matches. However because we convert
{a: {$ne: X}} to {$not: {a: {$eq: X}}} at parse time, we get the observed semantics. If people actually want that behavior, they could always type that directly.
Might not be able to fix this in MQL1.0, but probably worth keeping this in a list of things to fix for MQL2.0.