Conte documentos embutidos por status com unwind, match e group.
db.collection.aggregate([{ "$unwind":"$chat" },{ "$match":{ "chat.status":"pending" } },{ "$group":{ "_id":null,"count":{ "$sum":1 } } }])
Conte documentos embutidos por status com unwind, match e group.
db.collection.aggregate([{ "$unwind":"$chat" },{ "$match":{ "chat.status":"pending" } },{ "$group":{ "_id":null,"count":{ "$sum":1 } } }])