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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      ALL
    • Sprint:
      Query 2019-12-02

      Description

      {$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]
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: