While exploring mongoose for nodejs I ran into the problem of needing to know the amount of user in my collection:
My collection has records, each record has a user
Aggregation will work for you. Something like that:
Transaction.aggregate( { $match: { seller: user, status: 'completed' } }, { $group: { _id: '$customer', count: {$sum: 1} } } ).exec()