Overview
In this section, you can find complete tutorials that provide detailed explanations of common aggregation tasks in a step-by-step format. The tutorials are adapted from examples in the book Practical MongoDB Aggregations by Paul Done.
The tutorials include examples for each of the official MongoDB drivers. Use the Select your language drop-down menu in the upper-right of each tutorial to set the programming language for the examples.
Each tutorial includes the following sections:
About This Task: Describes the purpose and common use cases of the aggregation type. This section also describes the example and desired outcome that the tutorial demonstrates.
Before You Begin: Provides the template app for each language that explains where to add the aggregation stages. This section also shows sample code to create the necessary databases, collections, and sample data on which you run the aggregation pipeline.
Steps: Walks you through how to build and run the aggregation pipeline. This section describes each stage of the completed aggregation tutorial, and then explains how to run and interpret the output of the aggregation.
Tutorials
This section contains tutorials that demonstrate the following aggregation tasks: