-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
Request
Propagate aggregation/filter information to the transpiler's compile function to be used by the underlying visitors to create branches of logic (e.g use bson.A for filter, mongo.Pipeline for aggregation).
Motivation
With the context of the go driver, it's more idiomatic to use mongo.Pipeline for aggregations rather than bson.A. That is, something like this:
[{ $sort: { x: 1 } }]
Should output
mongo.Pipeline{ bson.D{{"$sort", bson.D{{"x", 1}}}}, }
At the moment, the transpiler method used to make this export will use whatever is returned by ArrayTypeTemplate:
bson.A{ bson.D{{"$sort", bson.D{{"x", 1}}}}, }
Both are valid code, the latter is just more correct and safer.
Proposal
Perhaps meta information about the export can be passed as an argument into compile. Right now compileWithDriver gets this information from the result, which seems reasonable.