Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-18341

Matcher returns false positives in comparison predicates with MinKey/MaxKey

    • Fully Compatible
    • ALL
    • v4.0, v3.6
    • Query 2018-07-02, Query 2018-07-16

      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.

            Assignee:
            minji.kim Minji Kim
            Reporter:
            rassi J Rassi
            Votes:
            2 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved: