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

[CQF] Index scan with equality to null incorrectly appends null if the field is missing

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • QO 2022-07-25, QO 2022-08-08, QO 2022-08-22

      assert.commandWorked(coll.insert([
          {_id: 1, a: 1, b: 1},
      ]));
      coll.createIndex({c: 1, _id: 1});
      assert.eq(coll.find({c: null}, {c: 1}).toArray(), [{_id: 1}]);
      

      This is specific to Bonsai and is not an issue with the classic optimizer. Since we cannot tell just from the index whether the field `c` is missing or null, this requires an extra fetch. However Bonsai appears to append c: null to the resulting document. The test that exercises this is here.

            Assignee:
            svilen.mihaylov@mongodb.com Svilen Mihaylov (Inactive)
            Reporter:
            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: