Can you show me how to utilize MongoDB's aggregation feature to summarize the count of each reason_id?
I have noticed that there are 2 counts for "reason_id = KW7Kcsv7835YZeE3n" and 1 count for "reason_id = KNcKQCjhFzha3oLfE".
Below is the dataset:
[
{
"_id": "2DLQFJLbZScBXpSam",
"toilet_id": "bJsyfh3TCvpTzE2mJ",
"reason_ids": [
"KNcKQCjhFzha3oLfE",
"KW7Kcsv7835YZeE3n"
],
"score_id": null,
"toilet": {
"_id": "bJsyfh3TCvpTzE2mJ",
"name": "Toilet_M_1",
"gender": "m",
"mac_address": "11:11:11:11:11:11"
}
},
{
"_id": "akjsbcjascklsacas",
"toilet_id": "bJsyfh3TCvpTzE2mJ",
"reason_ids": [
"KW7Kcsv7835YZeE3n"
],
"score_id": null,
"toilet": {
"_id": "fsgndgklndsdsdsd",
"name": "Toilet_F_1",
"gender": "f",
"mac_address": "11:11:11:11:11:11"
}
},
]