Below is my mongodb structure
[
{
"_id": "com.android.angrybirds",
"rating": [
{
"user": "BBE74610BEE1A92784FDB",
"value": "1"
},
{
"user": "BBE74610BEE1A92784F",
"value": "5"
},
{
"user": "BBE74610BEE1A9784F",
"value": "5"
}
]
}
]
I want to group and count the unique ratings. I tried to use aggregate, group but it didn't work.
Expected output
[
{
"_id": "com.avatarrom.angrybirds",
"rating": [
{
"1": 1,
"5": 2
}
]
}
]