Database

[{"groupId":"1111","customerId":"A100","tracks":[{"trackId":"234","infos":[{"location":{"address":"street1","city":"test","country":"US"}},{"location":{"address":"street2","city":"test","country":"US"}},{"location":{"address":"street3","city":"test","country":"US"}}]},{"trackId":"235","infos":[{"location":{"address":"street1","city":"test","country":"US"}}]}]},{"groupId":"2222","customerId":"A100","tracks":[{"trackId":"345","infos":[{"location":{"address":"street4","city":"test","country":"US"}},{"location":{"address":"street5","city":"test","country":"US"}},{"location":{"address":"street5","city":"test","country":"US"}}]}]},{"groupId":"2222","customerId":"A100","tracks":[{"trackId":"666","infos":[{"location":{"address":"street4","city":"test","country":"US"}},{"location":{"address":"street5","city":"test","country":"US"}},{"location":{"address":"street5","city":"test","country":"US"}}]}]}]

Query

db.collection.aggregate([{$unwind:"$tracks"},{$group:{"_id":"$groupId","count":{"$sum":{"$size":"$tracks.infos"}}}}])

Result