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

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

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Query Execution
    • Major Change

      {$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}.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: