For any field "a", the matcher falsely considers all documents (with the exception of {a: MaxKey} and {a: MinKey}) as matching the following predicates:
{a: {$gt: MaxKey}} {a: {$gte: MaxKey}} {a: {$lt: MinKey}} {a: {$lte: MinKey}}
Reproduce with the following shell snippet. The assertion on the last line fails.
db.foo.drop(); db.foo.insert({a: 1}); db.foo.ensureIndex({a: 1}); assert.eq(0, db.foo.find({a: {$gt: MaxKey}}).itcount()); // Passes as expected. db.foo.dropIndexes(); assert.eq(0, db.foo.find({a: {$gt: MaxKey}}).itcount()); // Fails: itcount() returns 1.
This is a regression introduced in 2.3.0 by e1085e54 (SERVER-3104). Affects all versions released since.
- is duplicated by
-
SERVER-33877 Inconsistent results when using MinKey/MaxKey in comparison operator when an index is present
- Closed
- related to
-
SERVER-11369 Change in behaviour of MinKey/MaxKey
- Closed
-
SERVER-3104 index bound improvements for elemMatch query on multikey index
- Closed