i have a timeseries collection whose size is expected to have 50M records, right now i’m doing a poc with 3M records in which i aggregate just using group and it takes 20 sec, how can i make it fast? Note: i have a index on source field but mongo ends up doing collscan.
Below query:
[
{
$group: {
_id: "$source",
sum: {
$sum: 1
}
}
}
]