[SERVER-67548] [CQF] Index scan with equality to null incorrectly appends null if the field is missing Created: 27/Jun/22  Updated: 29/Oct/23  Resolved: 06/Aug/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Nicholas Zolnierz Assignee: Svilen Mihaylov (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QO 2022-07-25, QO 2022-08-08, QO 2022-08-22
Participants:

 Description   

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.


Generated at Thu Feb 08 06:08:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.