Document layout
{
"_id": "5a21c5dff772de0555480ef5",
"date": "2017-10-06T00:00:00.000Z",
"amount": 1,
"location": "Canada",
"__v": 0
}
I am looking to calculate the total amount for each location and present the output in the following format:
{
"location": "Canada",
"amount": 8
}
Could you provide some guidance on how to construct an aggregate query for this purpose (or suggest an alternative approach)?