MongoDB Aggregation with Java
Learn how to create aggregation pipelines with Java.
MongoDB Aggregation with Java
Unit Overview
In this unit, you will learn how to perform basic aggregation with Java. First, you will learn what aggregation is and explore the stages and operators that can be included in an aggregation pipeline. Then, you'll learn how to build the $match and $group stages of an aggregation pipeline by using the Aggregates builder. You'll also learn how to build the $sort and $project stages of an aggregation pipeline by using the Aggregates builder. Finally, you'll learn about the Filters, Sorts, and Projections builder classes.
Prerequisites
Lessons in This Unit
- Lesson 01: Building a MongoDB Aggregation Pipeline in Java Applications
- Lesson 02: Using MongoDB Aggregation Stages with Java:
$matchand$group - Lesson 03: Using MongoDB Aggregation Stages with Java:
$sortand$project
Xijing Zhang I Curriculum Engineer
Xijing Zhang is currently a Curriculum Engineer here at MongoDB. Previously, she developed curriculum over at Docker after getting her degree in Electrical Engineering from the University of Southern California.
Joe Nyirenda I Senior Technical Trainer
Joe is a Senior Technical trainer based in London. Prior to joining MongoDB he consulted and delivered applications across a variety of industry sectors including publishing, utilities, telcos, vehicle telemetry, insurance, academia and government.
Daniel Curran | Senior Curriculum Designer
Daniel is a Senior Curriculum Designer at MongoDB. Before joining MongoDB, he worked as an Instructional Designer and Content Developer specializing in technical content for a host of international clients. Daniel's goal is to remove obstacles so learners can feel confident on their journey to become masters of MongoDB.
Hi there and welcome! In this unit, you will learn how to perform basic aggregation with Java.
I’m Xijing. I’m a Curriculum Engineer here at MongoDB and I will be working with you through this unit.
In the upcoming lessons, you’ll learn how to use the aggregation framework with Java. You’ll also learn how to create an aggregation pipeline by using the Java builder classes.
Aggregation is a great tool for filtering, sorting, organizing, and analyzing data without changing anything in your actual collection. With the aggregation framework, you can take your data to the next level.
This unit consists of three lessons. Each lesson begins with a short video lecture, followed by 1 to 3 quiz questions or hands-on lab questions.
First, we’ll give an overview of aggregation and the stages of an aggregation pipeline.
Then, we’ll explore the $match and $group stages of an aggregation pipeline and build those stages by using the Aggregates builder class.
Finally, we’ll examine the $sort and $project stages of an aggregation pipeline. Again, we’ll use the Aggregates builder class to build those stages.
We will also use the Filters, Sorts, and Projections builder classes to match, sort, and project.
Before beginning this unit, you should have a basic understanding of Java, theMongoDB 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 will be able to define aggregation and the pipeline stages, build an aggregation pipeline by using the Aggregates builder class, and use the Filters, Sorts, and Projections builder classes to match, sort, and project.
Let’s get started!