MongoDB Aggregation with C#

Learn how to create aggregation pipelines with C#.

MongoDB Aggregation with C#

Unit Overview

In this unit, you will learn how to perform basic aggregation with C#. First, you will learn what aggregation is and explore the stages and operators of an aggregation pipeline. Next, you'll learn how to build the Match and Group stages of an aggregation pipeline. Finally, you'll learn how to build the Sort and Project stages of an aggregation pipeline.

Prerequisites

Lessons in This Unit

  • Lesson 01: Building a MongoDB Aggregation Pipeline in C# Applications
  • Lesson 02: Using MongoDB Aggregation Stages with C#: Match and Group
  • Lesson 03: Using MongoDB Aggregation Stages with C#: Sort and Project
  • 01.
    Lesson 1: Building a MongoDB Aggregation Pipeline in C# Applications
    • Learn
    • Practice
  • 02.
    Lesson 2: Using MongoDB Aggregation Stages with C#: $match and $group
    • Learn
    • Practice
  • 03.
    Lesson 3: Using MongoDB Aggregation Stages with C#: $sort and $project
    • Learn
    • Practice
  • 04.
    Conclusion
    • Learn
Caleb Thompson | Staff Engineer

Caleb Thompson | Staff Engineer

Caleb is a Staff Engineer at MongoDB, working primarily on Realm education and documentation. He doesn't recall his life before MongoDB, but has been told he has previously served as an architect, software engineer, API designer, and curriculum design engineer. Caleb also loves teaching, rafting, wood working, and geology.

Parker Faucher | University Curriculum Engineer

Parker Faucher | University Curriculum Engineer

Parker is a Curriculum Engineer on the Education team at MongoDB. Prior to joining MongoDB, he helped maintain a world-class developer bootcamp that was offered in multiple universities. He is a self-taught developer who loves being able to give back to the community that has helped him so much.

Daniel Curran | Senior Curriculum Designer

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.

RP
October 23, 2023 2:21 PM


JR
October 17, 2023 11:35 AM

Good

SS
October 13, 2023 10:18 AM


MS
October 9, 2023 2:38 AM


NS
September 29, 2023 2:37 PM


SK
September 26, 2023 9:15 AM


VN
September 25, 2023 6:29 AM

Thank you

RR
September 24, 2023 9:54 AM

Super

Hi there and welcome! In this unit, you will learn how to perform basic aggregation with C#.

I’m Caleb. I’m a Staff Engineer here at MongoDB, and I’ll be working with you through this unit.

In this unit, you’ll learn how to create an aggregation pipeline by using builder classes, LINQ, and BsonDocuments.

MongoDB’s Aggregation framework is a powerful tool for filtering, sorting, organizing, and analyzing data without changing any data in your collection.

The lessons in this unit consist of video lectures followed by quiz questions or labs so that you can practice what you learned.

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.

Finally, we’ll explore the Sort and Project stages of an aggregation pipeline.

We will also use the Projections builder classes to project a custom field and value.

Before you begin this unit, you should have a basic understanding of: C#, the MongoDB database, the 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. You’ll also be able to build an aggregation pipeline by using the Match, Group, Sort, and Project stages.

Let’s get started!