Reputation: 11
[
{
"_id": 1,
c: [
{
d: [
{
b: [
{
a: 1
},
{
a: 2
},
{
a: 2
},
{
a: 2
}
]
}
]
}
]
}
]
We have this sample data and the question is // count() how many are the "c.d.b.a":2 in the collection // Final result: {"a":3} We can do it with unwind but the data is very big and unwind operation performance not good for big collections. Is there any other solution to this problem. playground
I have tried it with unwind but finding another solution without unwind operator
Upvotes: 0
Views: 31