To use MongoDB with C#, we should add the MongoDB dll as reference to solution.You can download the latest version of MongoDB dll from the Official site, Extract the Zipped folder and place in your system path.

Step by Step procedure to Add MongoDB reference to Solution:

Create the New Project as shown below.

Select Native ASP or MVC as per your usage(for framework > 4.0 )

Open solution explorer Right click on reference and ‘Add reference’

Browse the dll and then click on OK to add the MongoDB reference to the solution

After adding your solution should contain three dll as the reference.
  • MongoDB.Bson
  • MongoDB.Driver
  • MongoDB.Driver.core

Now we can access the MongoDB reference by adding Namespace in your class file.

Note: MongoDB driver 2.0 will supports for framework 4.5 and higher, for 4.5 below versions recommended to use 1.10