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

Change {$ne: null} semantics to be more intuitive

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Querying
    • Labels:

      Description

      {$ne: null} has some counterintuitive behavior which has hurt us several times now:

      db.c.insert({a: [1, {c: 1}]});
      db.c.insert({a: [1]});
       
      db.c.find({"a.b": {$exists: true}}) // Returns nothing.
      db.c.find({"a.b": {$ne: null}}) // Returns {a: [1]} !!!!
      

      That is, {$ne: null} doesn't necessarily return a subset of the things that {$exists: true} returns. This ticket is to track the work of changing the meaning of {$ne: null}.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated: