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

Short circuit $cond if condition is a constant

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1.0-rc0
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      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

          Issue Links

            Activity

              People

              Assignee:
              alexander.ignatyev Alexander Ignatyev
              Reporter:
              david.percy David Percy
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: