The MongoDB Aggregation Framework provides a means to reshape and aggregate data in MongoDB 2.2+.

The MongoDB Aggregation Framework provides a means to reshape and aggregate data in MongoDB 2.2+.

If you're familiar with SQL, the Aggregation Framework provides similar functionality to GROUP BY and related SQL operators, as well as simple forms of "self joins". Additionally, the Aggregation Framework provides projection capabilities to reshape the returned data. Using the projections in the Aggregation Framework you can add computed fields, create new virtual sub-objects, and extract sub-fields into the top-level of results.

Other options for aggregating data in MongoDB include:

Documentation

Related Tags