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

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

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

      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@mongodb.com Rui Liu
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: