The MongoDB aggregation pipeline framework consists of the aggregate() collection method, and a sequence of operations referred to as stages (https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/#aggregation-pipeline-stages). This sequence is referred to as a pipeline.
For illustration, let's assume that there's a collection called purchases, where each purchase has an amount of information as well as embedded customer and product objects:
We wish to generate a report on the total sales for each customer from Australia. A simple db.collection.find() command will not suffice as it is incapable of grouping the customers. The problem is further compounded by the fact that country information is embedded in the customer object within each purchase. In order to generate this report, we will first need to address stages.