Not sure if this can be done, but I gotta ask:
Can I send in multiple aggregation in one request? In other words, rather than doing the following:
one_results = db.results.aggregate([
{ $project: { _id: 0, key: "$Field1" }},
{ $group: { '_id': '$key', count: { $sum: 1 }}} ])
two_results = db.results.aggregate([
{ $project: { _id: 0, key: "$Field2" }},
{ $group: { '_id': '$key', count: { $sum: 1 }}} ])
I want to do something like this:
[one_results, two_results] = db.results.aggregate(
[
{ $project: { _id: 0, key: "$Field1" }},
{ $group: { '_id': '$key', count: { $sum: 1 }}}
],
[
{ $project: { _id: 0, key: "$Field1" }},
{ $group: { '_id': '$key', count: { $sum: 1 }}}
])
I know it's a stretch, but I gotta ask...
Thanks