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

Short circuit $ifNull expression if the condition always evaluates to a constant or null

    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:
      Query Optimization 2021-06-28, Query Optimization 2021-07-12

      Description

      The evaluate() method of ExpressionIfNull short circuits when it finds the first non-nullish value. So an expression like {$ifNull: [null, "$a"]} could be optimized to "$a".

      Currently it doesn't override optimize(). It inherits some optimizations from ExpressionNary, but short circuiting is not one of them.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              alice.doherty Alice Doherty (Inactive)
              Reporter:
              nicholas.zolnierz Nicholas Zolnierz
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: