Mongo Aggregation pipeline Queries //Pipeline Query use Collection; db.getCollection(collectionName).aggregate( [ { " $match " : { " {field1} " : { " $eq " : " string " }, " {field2} " : { " $eq " : " string " } }, }, { " $group " : { " _id " : " $field " , " Count " : { " $sum " : 1.0 }, " Results " : { " $addToSet " : " $field " } } }, { " $sort " : { " Count " : -1.0 } }, { " $project " : { " count " : 1.0, " _id " : 1.0, " AccountId " : 1.0 } } ],