mongo-cookies Cookbook for MongoDB. Or practical example how to do that and how to do this. Aggregation Framework Aggregation Framework find duplicates nested groupby