Aggregation Pipelines
Running a pipeline
- Select a collection from the sidebar
- Navigate to the Aggregation tab
- Enter a pipeline as a JSON array
- Click Run Pipeline
Examples
Count by field
[{"$group": {"_id": "$status", "count": {"$sum": 1}}}]
Filter and project
[
{"$match": {"age": {"$gte": 21}}},
{"$project": {"name": 1, "age": 1, "_id": 0}}
]
Top 5 by score
[
{"$sort": {"score": -1}},
{"$limit": 5}
]
Lookup (join)
[
{"$lookup": {
"from": "orders",
"localField": "_id",
"foreignField": "userId",
"as": "orders"
}},
{"$project": {"name": 1, "orderCount": {"$size": "$orders"}}}
]
Unwind arrays
[
{"$unwind": "$tags"},
{"$group": {"_id": "$tags", "count": {"$sum": 1}}},
{"$sort": {"count": -1}}
]
Notes
- Results are limited to 100 rows in the display
- The pipeline runs on the currently selected collection
- Supports all standard MongoDB aggregation stages