I have a collection where every documents has an array named "contacts".
Sample Docs :
{
"_id" : ObjectId("5660c2dfdfdfcba2d47baa2d9"),
"name" : john,
"contacts" : [
{
"name" : "ari",
"phone" : "12341234"
},
{
"name" : "dea",
"phone" : "34234234"
}
]
},
{
"_id" : ObjectId("5660c2dfdfdfcba2d47baa2d9"),
"name" : joni,
"contacts" : [
{
"name" : "budi",
"phone" : "13341234"
},
{
"name" : "ade",
"phone" : "3242343"
},
{
"name" : "are",
"phone" : "64545345"
}
]
}
I want to know get total count of contacts for all docs. From sample docs output should be 5 contacts
Thank you for helping me.