NEW
A sequence of operations that transforms and aggregates data to produce computed results, common in document databases.
DESCRIPTION
Aggregation pipelines process documents through ordered stages (e.g., match, group, project) to filter, transform, and summarize data. Popularized by MongoDB, they enable expressive analytics close to the data, reducing data movement and leveraging indexes. Pipelines can compute windowed metrics, joins, and facets. They underpin real-time dashboards, ETL/ELT tasks, and materialized views in document-oriented systems.
ALTERNATIVE DEFINITIONS
MongoDB Manual
The aggregation pipeline is a framework for data aggregation modeled on the concept of data processing pipelines.
Defines the pipeline paradigm and its stages within MongoDB.
MongoDB Manual
Aggregation operations group values from multiple documents, and can perform a variety of operations on the grouped data to return a single result.
Focuses on grouping and computation aspect of aggregation.
RELATED TERMS
Document Database Extract-Transform-Load Data Transformation Pipeline Stage Query Optimization Group By Window Function Materialized View
COMPETING TERMS
RELATIONS
- Broader: Data Pipeline
KNOWLEDGE AREAS
Data Engineering Data Storage & Operations Platform & Tooling Data Integration & Interoperability
TARGET AUDIENCE
Data Engineer Analytics Engineer Software Developer Data Architect BI Specialist
EXTERNAL SOURCES
- Wikipedia - MongoDB
- MongoDB - Core documentation of the pipeline framework
- MongoDB - Reference of aggregation operators and stages
- Microsoft Learn - Cosmos DB MongoDB aggregation support
TOP QUESTIONS
Why use an Aggregation Pipeline instead of application-side processing?
Running aggregations near the data reduces network overhead, leverages indexes, and can use engine-level optimizations for better performance and simplicity.
Category: Relevancy
What are common Aggregation Pipeline stages?
Common stages include project, sort, setWindowFields. They compose to filter, reshape, join, and compute metrics.
Category: Example
How do I optimize Aggregation Pipelines?
Filter early with unwind without filters, and review explain plans for bottlenecks.
Category: Management
What is a common mistake with Aggregation Pipelines?
Overusing group stages, causing memory pressure. Pre-aggregate or reshape data to manage scale.
Category: Mistakes
Can Aggregation Pipelines support real-time dashboards?
Yes, with indexes and efficient stages, pipelines power low-latency summaries. Consider materialized views or pre-aggregation for spikes.
Category: Example
Do Aggregation Pipelines replace ETL tools?
They can implement many ELT/ETL transformations in-database but often complement orchestration tools for scheduling, lineage, and monitoring.
Category: Opinion
How do window functions work in Aggregation Pipelines?
$setWindowFields computes rank, moving averages, and other analytics over partitions and sorts, enabling time-series and cohort analyses.
Category: Example
What is the biggest risk in Aggregation Pipelines at scale?
Unbounded memory or disk usage in sort. Use pipeline memory limits, partitions, and selective filtering to avoid resource exhaustion.
Category: Risks
How to test Aggregation Pipelines effectively?
Create unit tests for stage-by-stage outputs, use sample fixtures, and verify performance characteristics with explain plans on representative data.
Category: Testing