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

Indexed $gte/lte does not produce superset of results returned by $eq for 'undefined' values

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • ALL
    • Query 2019-12-02

      {$eq: null} returns true for missing, null and undefined values. Our index bounds generation does not include 'undefined' for predicates like {$gte: null} (or $lte).

      db.c.insert({a: null})
      db.c.insert({a: undefined})
      db.c.find({a: {$gte: null}})
      // Returns both documents inserted
      db.c.createIndex({a: 1})
      db.c.find({a: {$gte: null}})
      // Only returns the document containing 'null' because bounds generated are only for [null, null]
      

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: