-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
Fully Compatible
-
QO 2022-12-26
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".