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

[CQF] reverseComparisonOp negates when it should flip

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • None
    • None
    • Query Optimization
    • Fully Compatible
    • QO 2022-12-26

    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".

      Attachments

        Activity

          People

            will.buerger@mongodb.com Will Buerger
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: