These operations provide a simple access control upon the common processes of aggregation.
In MongoDB we have three kinds of aggregation operations for a single filtration:Īll of the above operations are used for single purpose aggregation. In simple words, if we have to aggregate a whole collection based on one filter, then we have to use single-purpose aggregation operations.
In the single purpose aggregation, only one filter is applied to calculate the result. Somehow pipelines can also be used to summarize the content or to calculate the average and concatenation of record.Ĭode db.orders.aggregate([).find() On the other hand, pipeline operations are also used for sorting, grouping, merging & aggregation of arrays and arrays of the document. First, the records are filtered just like how queries are performed and in the second phase, the transformation of the document happens to change its type for output purpose. In this pipeline, a set of various functions are applied on a document which is entered in the pipeline to aggregate the final result.īasically, two operations are performed on any document within the pipeline. Aggregation Framework in MongoDB is developed on the concept of data processing pipelines.