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

Allow $cond to accept longer arrays

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Query Optimization

      Why not allow the array form of $cond to accept longer arrays of if-then-elseif-then conditions? Instead of restricting it to only accepting arrays of length 3, it could accept any array of length 2*n + 1, with obvious interpretation:

      { "$cond": [ if, then, elseif, then, elseif, then, ..., else ] }

      . This is clearer and simpler than having to nest multiple $cond terms.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            kperry Kevin Perry
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: