I've gotten lost in my notes too many times so this is a reference for my future self and anyone else who needs this.
In an aggregation pipeline, add the following.
$group {
_id: null (or whatever),
countries: {
$addToSet: "$subCollection.countries"
}
}
This will result in
{
_id: null,
countries: ["a", "b", "c", etc...]
}
Top comments (0)