Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /
/ / / /

Group and Total Data

This tutorial illustrates how to construct an aggregation pipeline, perform the aggregation on a collection, and display the results using the language of your choice.

This tutorial demonstrates how to group and analyze customer order data. The results show the list of customers who purchased items in 2020 and include each customer's order history for 2020.

The aggregation pipeline performs the following operations:

  • Matches a subset of documents by a field value

  • Groups documents by common field values

  • Adds computated fields to each result document

The following steps demonstrate how to create and run an aggregation pipeline to group documents and compute new fields.

Back

Filter and Subset

On this page