Assuming I have a collection with 100k documents structured like this:
{
{
userName: "cary"
time: 50
userId: 1
}
{
userName: "john"
time: 40
userId: 1
}
{
userName: "bliss"
time: 50
userId: 1
}
{
userName: "ross"
time: 40
userId: 1
}
...
...
etc...
}
In order to query this collection and retrieve the count of users with times less than 40, 50, 60, etc., the expected result format would be:
{
time: UsersCountWithParticularTime,
‘40’: 150,
‘50’: 50,
‘60’: 75,
‘40’: 90,
}
Is there a way to achieve this desired outcome?