[SERVER-67853] Fix ABT Translation for comparing GTE and LTE null Created: 07/Jul/22  Updated: 29/Oct/23  Resolved: 07/Sep/22

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

Type: Improvement Priority: Major - P3
Reporter: Emily Wang (Inactive) Assignee: Militsa Sotirova
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: QO 2022-07-25, QO 2022-08-22, QO 2022-09-05, QO 2022-09-19
Participants:

 Description   

Currently in Bonsai if you compare if you do a find(a: {$gte: null} ) query, documents without the "a" field are incorrectly missing from the results.

Ex. find( a: {$gte: null} )

actual=[ { "_id" : 1, "a" : null } ],expected=[ { "_id" : 1, "a" : null }, { "_id" : 2, "b" : "" } ]

The issue lies in generateSimpleComparison. The solution likely is in the cases for Operations::Lte and Operations::Gte, where a PathDefault node must be included for the null case. 
Note that this is already done for Operations:Eq in generateSimpleComparison, but must be added for Lte and Gte.

The exact same problem exists for Minkey/MaxKey. If you do find(a: {$lte: MaxKey()} ) documents without the "a" field are incorrectly missing from the results. The bugfix for minkey and maxkey should be the exact same as the null case.

Ex. find( a: {$lte: MaxKey()} )

actual=[ { "_id" : 1, "a" : null } ],expected=[ { "_id" : 1, "a" : null }, { "_id" : 2, "b" : "" } ]

 



 Comments   
Comment by Githook User [ 06/Sep/22 ]

Author:

{'name': 'Militsa Sotirova', 'email': 'militsa.sotirova@mongodb.com', 'username': 'militsasotirova'}

Message: SERVER-67853 fix type bracketing for null in GTE and LTE ABT translation
Branch: master
https://github.com/mongodb/mongo/commit/abee805af5bda67e63f6851f93cb406286fb13b8

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