[SERVER-71500] [CQF] reverseComparisonOp negates when it should flip Created: 18/Nov/22  Updated: 29/Oct/23  Resolved: 21/Dec/22

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

Type: Bug Priority: Major - P3
Reporter: David Percy Assignee: Will Buerger
Resolution: Fixed Votes: 0
Labels: cascades-starter
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Backwards Compatibility: Fully Compatible
Sprint: QO 2022-12-26
Participants:

 Description   

With forceBonsai enabled:

> db.c.find()
{ "_id" : ObjectId("6377f2f520fd1e38034e8012"), "a" : 1 }
{ "_id" : ObjectId("6377f2f720fd1e38034e8014"), "a" : 2 }
{ "_id" : ObjectId("6377f2f920fd1e38034e8016"), "a" : 3 }
> db.c.find({$expr: {$lt: [2, "$a"]}})
{ "_id" : ObjectId("6377f2f720fd1e38034e8014"), "a" : 2 }
{ "_id" : ObjectId("6377f2f920fd1e38034e8016"), "a" : 3 }

The problem is `reverseComparisonOp` is supposed to flip the argument order (Lt to Gt), but it converts Lt to Gte instead. Possibly we were confusing "flip argument order" with "negate boolean result".



 Comments   
Comment by Githook User [ 21/Dec/22 ]

Author:

{'name': 'Will Buerger', 'email': 'will.buerger@mongodb.com', 'username': 'wbuerger46'}

Message: SERVER-71500: fix reverseComparisonOp to reverse instead of negate
Branch: master
https://github.com/mongodb/mongo/commit/ebbb36a531d6a137d817c4f833050da3964411dd

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