Aggregation operation process the data records and provide the outcomes after computation. Able to perform a variety of operations, Aggregation operations combine the values from various sources and group the outcome into a single result.
Aggregate () method
This method is used to perform aggregation operations using following command –
Pipeline concept in MongoDB
Pipeline concept works in using the output of one process as the input of the next process. This concept can be applied in MongoDB framework using following commands-
- $project − For selecting specific fields from the collection.
- $match − For reducing the amount of documents to be given as input in the next stage.
- $group − Performs aggregation.
- $sort − For sorting the documents.
- $skip − For skipping forward in the list of documents.
- $limit − To restrict the amount of documents to be viewed starting from the current position.
- $unwind − To unwind the documents that use the arrays.