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

Short circuit $cond if condition is a constant

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • None
    • None
    • Fully Compatible
    • QE 2021-08-09

    Description

      ExpressionCond::evaluate() only evaluates one or the other branch, depending on the value of the condition. We should have it do the same short-circuiting during optimize(). An expression like {$cond: [true, "$a", "$b"]} can be simplified to "$a", even though "$a" and "$b" are not constants.

      Attachments

        Activity

          People

            alexander.ignatyev@mongodb.com Alexander Ignatyev
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: