In version 2.2, MongoDB introduced the aggregation framework that provides a powerful and flexible set of tools to use for many data aggregation tasks. If you’re familiar with data aggregation in SQL, consider the SQL to Aggregation Framework Mapping Chart document as an introduction to some of the basic concepts in the aggregation framework. Consider the full documentation of the aggregation framework and other data aggregation tools for MongoDB here: