-
Type: New Feature
-
Resolution: Unresolved
-
Priority: 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.