From the course: MongoDB Essential Training

An overview of stages

- MongoDB's aggregation framework allows you to manipulate and transform data in ways that are not possible with the normal queries that we've discussed so far. If you are familiar with Unix pipes, you can think of aggregation pipelines in a similar way. A pipeline can consist of one or more stages that each transform data and then pass the stages outputs onto the next stage, if there is a next stage. Accumulator stages, like the dollar group stage, must process all documents before results can be passed to the next stage. Other stages can pass results to the next stage as they are processed. There are many different pipeline stages. We will discuss some of the most commonly used ones individually in the next videos. There are some stages that are commonly used, but we won't spend time discussing them because you have already encountered them either as a query operator or as a dedicated method when we were talking about crowd operations. To perform an aggregation, you can use the Aggregate command and pass an array of stages as the argument. Inside stages, you can make use of pipeline operators. There are a lot of them. Essentially, any common operations that you can do on an object within a programming language have an equivalent operator. We will use a few of these in the next few videos, but definitely not all. Feel free to pass this video and skim over them here. Or, if this is too small, go to the MongoDB documentation on all of the operators.

Contents