MongoDB Aggregation in Python
Learn how to create aggregation pipelines with Python.
MongoDB Aggregation with Python
Unit Overview
In this unit, you'll learn how to perform basic aggregation with Python. First, you'll learn what aggregation is and explore the components of an aggregation pipeline. Next, you'll learn how to build a pipeline that uses the $match and $group stages. Finally, you'll explore the $sort and $project stages and build a pipeline that uses them.
Prerequisites
Lessons in This Unit
- Lesson 01: Building a MongoDB Aggregation Pipeline in Python Applications
- Lesson 02: Using MongoDB Aggregation Stages with Python:
$matchand$group - Lesson 03: Using MongoDB Aggregation Stages with Python:
$sortand$project
Julianna Chen I Senior Curriculum Engineer
Julianna is a Senior Curriculum Engineer on the Education team, based in Vancouver, Canada. She’s developed educational content at universities and non-profits for over ten years, and is passionate about supporting access to quality technical education worldwide.
Emily Pope | Senior Curriculum Designer
Emily is a Senior Curriculum Designer at MongoDB. Prior to MongoDB, Emily worked closely with professors at MIT and Columbia to design bootcamps in full stack development and data science at Emeritus. She also worked as an instructional designer on database and computer science learning experiences at Cengage. Emily loves learning about the everchanging tech space and is passionate about making these skills accessible to a global audience.
Hi there and welcome! In this unit, you’ll learn how to perform basic aggregations with Python.
I’m Julianna Chen. I’m a curriculum engineer here at MongoDB, and I’ll be working with you through this unit.
In the upcoming lessons, you’ll learn how to create aggregation pipelines by using PyMongo, the official MongoDB driver for synchronous Python applications.
MongoDB’s aggregation framework is a powerful language for filtering, sorting, organizing, and analyzing data, without changing any data in your actual collection.
The lessons in this unit consist of videos followed by quiz questions and labs so that you can practice what you’ve learned.
First, we’ll give you an overview of aggregation and the components of an aggregation pipeline.
Then, we’ll explore the match and group stages of an aggregation pipeline and build a pipeline with these stages.
Finally, we’ll examine the sort and project stages and build a pipeline that uses them.
Before you begin this unit, you should have a basic understanding of: Python, the MongoDB database and document model, and Atlas.
You will also need to set up an Atlas account with a free tier cluster.
By the end of this unit, you’ll be able to define aggregation and its pipeline stages. You’ll also be able to build an aggregation pipeline by using the match, group, sort, and project stages.
Let’s get started!