Investigate changes in SERVER-36681: Dotted path {$ne: null} against array of scalars returns incorrect results

    • Type: Investigation
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Tools and Replicator
    • 18

      Original Downstream Change Summary

      This changes the behavior of matching dotted field paths to null (eg. $in, $nin, $eq, $ne, $gte, $lte). In particular, if a document has

      {a: []}

      and we query for "a.b" $eq null, it will now match, whereas before it didn't. There is a new query knob that disables this fix and restores the old behavior, internalQueryLegacyDottedPathNullSemantics

      Description of Linked Ticket

      {$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 fix incorrect logic in matcher path to fix this.

       

      This ticket is to track the work of changing the meaning of {$ne: null}.

            Assignee:
            Unassigned
            Reporter:
            Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: