This lesson will discuss BSON objects and how to map them to a C# object. It will also introduce a database and its C# equivalent which we will use for learning purposes.


In previous chapters, Mongo DB basics part 1 and part 2, we covered some of the foundations of this database. We learned how to create databases, collections, documents, and we learned how to use them. We also learned information about distributing MongoDB, shards, replica sets, and how to manipulate each of these entities

Nevertheless, there is no single line of code, and everything is explained in a general manner (more or less). MongoDB Shell Client was used to demonstrate all of the crucial operations, so readers were not exposed to any coding lessons.

That is why, here, we’ll try to show you how MongoDB can be used, in the code, to automatically do some of the operations shown in the previous lessons. So, let’s take a look at how MongoDB can be used in .NET, by implementing a simple MongoDB CRUD Repository.

Get hands-on with 1200+ tech skills courses.