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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • Query Execution
    • ALL
    • QE 2022-09-19

    Description

      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.

      Attachments

        Activity

          People

            backlog-query-execution Backlog - Query Execution
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated: