I have following collection. each document may be represented as following. there can be multiple customer referees for each document.
{
_id:objectId(""),
customerId: "Some Id",
name: "Customer name",
customerReferee: [
{
status: 'COMPLETED',
name: "Referee name1"
},
{
status: 'PENDING',
name: "Referee name2"
},
],
}
I would like to have top 20 documents who has maximum number of 'COMPLETED' customerReferees.