MongoDB CRUD Operations in C#

Learn how to perform basic CRUD operations with the MongoDB C# driver.

MongoDB CRUD Operations in C#

Unit Overview

In this unit, you will learn how to perform basic MongoDB CRUD operations with the MongoDB C# driver. First, you will learn how BSON documents are expressed in C#. Then, you'll learn how to insert, query and retrieve, update, and delete documents in a C# application. Finally, you'll learn how to create a multi-document transaction.

Prerequisites

Lessons in This Unit

  • Lesson 01: Working with MongoDB Documents in C#
  • Lesson 02: Inserting a Document in C# Applications
  • Lesson 03: Querying a MongoDB Collection in C# Applications
  • Lesson 04: Updating Documents in C# Applications
  • Lesson 05: Deleting Documents in C# Applications
  • Lesson 06: Creating MongoDB Transactions in C# Applications
  • 01.
    Lesson 1: Working with MongoDB Documents in C#
    • Learn
    • Practice
  • 02.
    Lesson 2: Inserting a Document in C# Applications
    • Learn
    • Practice
  • 03.
    Lesson 3: Querying a MongoDB Collection in C# Applications
    • Learn
    • Practice
  • 04.
    Lesson 4: Updating Documents in C# Applications
    • Learn
    • Practice
  • 05.
    Lesson 5: Deleting Documents in C# Applications
    • Learn
    • Practice
  • 06.
    Lesson 6: Creating MongoDB Transactions in C# Applications
    • Learn
    • Practice
  • 07.
    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 Engineer

Daniel Curran | Senior Curriculum Engineer

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.

JS
October 18, 2023 1:32 PM

Good

NS
October 17, 2023 1:11 AM


KK
October 13, 2023 3:52 PM


NS
October 13, 2023 11:51 AM


MS
October 13, 2023 6:49 AM


NN
September 14, 2023 6:51 AM

Very good

Hi there and welcome! In this unit, you’ll learn how to perform basic CRUD operations with C#.

For true beginners, CRUD stands for Create, Read, Update, and Delete.

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

Using CRUD, you’ll be able to interact with your data in your C# application. A database is only useful if you can leverage the data.

In this unit, we’ll also cover how to create a multi-document transaction in C# so that you can ensure your operations are ACID compliant.

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

First, you will learn how BSON documents are expressed in C# by using classes and builders.

Then, you’ll learn how to insert documents into your application.

You’ll also learn how to query documents from a collection.

Next, you will learn how to perform single and multiple document updates.

Then, you’ll learn how to delete single or multiple documents.

Finally, you’ll learn how to create a multi-document transaction.

Before you begin, you should have a basic understanding of C#, 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 will be able to describe how BSON documents are expressed in C#, perform basic CRUD operations in C#, and create a multi-document transaction.