[SBE] Missing query results when comparing field to Min/MaxKey and field is missing from document

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.1.0-rc0, 8.0.4
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0
    • QE 2022-09-19
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Consider the following example running the classic engine:

      > db.c.insert({b: 1})
      > db.c.find({a: {$gt: MinKey()}})
      {b: 1}

      Because the `a` field is missing in the document, it is implicitly `null` for the purposes of evaluating `a > MinKey()`. Because of BSON ordering semantics, `null` is greater than `MinKey()`, and results in the document being matched.

      When SBE (featureFlagSbeFull) is enabled, the server incorrectly omits this document.

              Assignee:
              Rui Liu
              Reporter:
              Ben Shteinfeld
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: