Repository abstraction layer on top of Official MongoDB C# driver
C# Other
Switch branches/tags
Nothing to show
Clone or download
RobThree * Updated to 1.11 driver
* Removed stale classdiagrams
Latest commit 8a24feb Mar 31, 2016

Logo Project Description

An easy to use library to use MongoDB with .NET. It implements a Repository pattern on top of Official MongoDB C# driver. This project is now available as a NuGet package for your convenience. If you're new to NuGet, check it out; it's painless, easy and fast. You can find this project by searching for MongoRepository in NuGet (or simply clicking here).

Check the documentation for a step-by-step example and more advanced usage.


// The Entity base-class is provided by MongoRepository
// for all entities you want to use in MongoDb
public class Customer : Entity 
        public string FirstName { get; set; }
        public string LastName { get; set; }

public class CustomerRepoTest
        public void Test()
            var repo = new MongoRepository<Customer>();

            // adding new entity
            var newCustomer = new Customer {
                FirstName = "Steve",
                LastName = "Cornell"


            // searching
            var result = repo.Where(c => c.FirstName == "Steve");

            // updating 
            newCustomer.LastName = "Castle";

Productivity Visual Studio add-in for C#, VB.NET, XML, XAML, ASP.NET and more