Given:
A collection where I have some columns where for two of them I want to get all used values
Currently I'm doing two aggregations like below (simplified)
db['myCollection'].aggregate(
[{$group: {"_id":"$firstCol"}} ]
);
and
db['myCollection'].aggregate(
[{$group: {"_id":"$secondCol"}} ]
);
But it feels like a waste of resources to run two aggregations. Is there a way to get both grouped results at once?
I thought about combining them and later on split it in code.