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

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

    XMLWordPrintable

Details

    • Task
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • Querying
    • Major Change

    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

              backlog-query-execution Backlog - Query Execution
              ian.boros@mongodb.com Ian Boros
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated: