-
Type:
New Feature
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
None
-
0
-
None
-
None
-
None
-
None
-
None
-
None
When writing complex aggregation queries, the expressions can become difficult to read. Perhaps being able to provide a string that can be parsed to the current syntax might help simplifying expressions.
Here is an example for a group stage:
{ $group: { _id: '$field', foo: { $add: ["$field1", {$multiply: ["$field2", {$subtract: [90,"$field3"]}]}] } }
Compared to this:
{ $group: { _id: '$field', foo: "$field1 + $field2 * (90 - $field3)" } }
A simple stack structure could be used to transform the latter into the former. Obviously, there are scenarios in which you couldn't use this syntax to mirror the current implementation, but that's not the intention either.
I've been going through some of our large aggregation queries and a lot of them are just formulas that could be made a lot easier to read if such a feature existed.
- is related to
-
SERVER-29406 syntactic sugars for aggregations
-
- Closed
-