Group query using mongoose 4.11.0
What you're looking for is mongoDB aggregation pipeline. The following will group the patient documents on the basis of gender:
Patient.aggregate( [ //{ // $match: {email: {$exists: true}} //you can also match some criteria //}, { $group: { _id: "$gender" } } ] ) .then((result) => { console.log(result); });