-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Query
This is a problem that extends to all functions in the aggregation framework, both those that expect positional arguments in the form of arrays, and those that expect named arguments in the form of objects. Fixing this issue will be fairly labor intensive, and it is not a critical improvement; it just limits the amount of partial redundancy elimination we can do when optimizing pipelines.
db.foo.aggregate({$project: {out: {$let: {vars: {x: [1,2]}, in: {$add: "$$x"}}}}}) 2019-04-02T14:21:18.263-0400 E QUERY [js] Error: command failed: { "ok" : 0, "errmsg" : "$add only supports numeric or date types, not array", "code" : 16554, "codeName" : "Location16554" } : aggregate failed :
This occurs because the parse methods for the individual expressions check for arrays and objects/specific object keys statically before the pipeline runs, so addressing this will also lose us some of our static checking capabilities.
- duplicates
-
SERVER-31991 Allow n-ary aggregation expressions to compute their array of arguments dynamically
- Backlog