Hi Mates,
_id:60ed7ca7ba35360001d5d7e3
createdTime:1626176679084
members:
Array
1. 0:"758bd45b-0741-430b-ae3c-af0f1c2e42b7"
2. 1:"b778749e-35b3-4b94-9b46-a145579a6b26"
3. 2:"883dff93-0205-46de-9cf3-c9c364267667"
type:"savings"
state:"active"
I’ve documents like this in my DB Collection. I have to get the total of Members(Array) when the type is equal to Savings and State equal to Active. However, I managed to get the output like below.
{
"total": 3
},
{
"total": 3
},
{
"total": 3
},
{
"total": 4
}
It’s returning me the size of members in each document. But, I want to get the grand total when the conditions meet the requirement.
Can you guys Suggest me the Aggregation Query ann Spring Boot Solution(If Possible)