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
If you just want get the number of queried collections, you can use this:
Record.find() .distinct('user_id') .count(function (err, count) { //The number of unique users is 'count' });