Aggregation Pipeline in Mongo DB
What is Pipeline
Pipeline in mongo DB refers to a series of stages that process document in sequence. each stage take a input performs an operation on them and then passes the result to the next stage.
What is aggregation
Aggregation is a mongo DB framework which is used to perform advanced data processing and tranformation operations on collection. Aggregation in mongo DB provide us with many operation which we can use to manipulate document.
What is aggregation Pipeline
An aggregation pipeline consist one or more stages that process document. each stages can perform task such as filtering document, calculate document, calculating values.
working of aggregation pipeline
let's understand this with an example, if we have 100 documents and if we have applied a filter on first stage where only 50 document passes the condition/applied filter. then from next stage all the operation/method will apply only on that 50 document.
ex - { $match: { status: "A" } }, lookup, sort, group, project, AddFields
Subscribe to my newsletter
Read articles from Pappu Kr Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by