MongoDB Aggregation Framework Stages and Pipelining

MongoDB supports rich queries through it’s powerful aggregation framework, and allows developers to manipulate data in a similar way to SQL. Effectively, it allows developers to perform advanced data analysis on MongoDB data. This whitepaper provides a foundation of essential aggregation concepts - how multiple documents can be efficiently queried, grouped, sorted and results presented in appropriate ways for reports and dashboards.

Get the whitepaper

Introducton

MongoDB supports rich queries through it’s powerful aggregation framework, and allows developers to manipulate data in a similar way to SQL. Effectively, it allows developers to perform advanced data analysis on MongoDB data. This whitepaper provides a foundation of essential aggregation concepts - how multiple documents can be efficiently queried, grouped, sorted and results presented in appropriate ways for reports and dashboards.

Table of contents

  • Introduction
  • What is the Aggregation Framework?
  • Aggregation Pipeline
    • Basic Stages of Aggregation Pipeline
      • $match
      • $group
      • $unwind
      • $project
        • Points to note
      • $sort
      • $sample
      • $limit
      • $lookup
  • Aggregation Process
  • Accumulator Operators
    • $sum
    • $avg
    • $max and $min
    • $push
  • Similarity of the Aggregation Process in MongoDB with SQL
  • Aggregation Pipeline Optimization
    • Projection Optimization
    • Pipeline Sequence Optimization
  • MapReduce in MongoDB
    • MapReduce JavaScript Functions
    • Incremental MapReduce
  • Comparison Between MapReduce and Aggregation Pipeline in MongoDB
  • Summary
ClusterControl
The only management system you’ll ever need to take control of your open source database infrastructure.