MongoDB.Driver.Core 2.30.0

MongoDB C# Driver

You can get the latest stable release from the official Nuget.org feed or from our github releases page.

Getting Started

Untyped Documents

using MongoDB.Bson;
using MongoDB.Driver;
var client = new MongoClient("mongodb://localhost:27017");
var database = client.GetDatabase("foo");
var collection = database.GetCollection<BsonDocument>("bar");

await collection.InsertOneAsync(new BsonDocument("Name", "Jack"));

var list = await collection.Find(new BsonDocument("Name", "Jack"))
    .ToListAsync();

foreach(var document in list)
{
    Console.WriteLine(document["Name"]);
}

Typed Documents

using MongoDB.Bson;
using MongoDB.Driver;
public class Person
{
    public ObjectId Id { get; set; }
    public string Name { get; set; }
}
var client = new MongoClient("mongodb://localhost:27017");
var database = client.GetDatabase("foo");
var collection = database.GetCollection<Person>("bar");

await collection.InsertOneAsync(new Person { Name = "Jack" });

var list = await collection.Find(x => x.Name == "Jack")
    .ToListAsync();

foreach(var person in list)
{
    Console.WriteLine(person.Name);
}

Documentation

Questions/Bug Reports

If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here.

Contributing

Please see our guidelines for contributing to the driver.

Thank you to everyone who has contributed to this project.

Showing the top 20 packages that depend on MongoDB.Driver.Core.

Packages Downloads
MongoDB.Driver
Official .NET driver for MongoDB.
78
MongoDB.Driver
Official .NET driver for MongoDB.
68
MongoDB.Driver
Official .NET driver for MongoDB.
52
MongoDB.Driver
Official .NET driver for MongoDB.
51
MongoDB.Driver
Official .NET driver for MongoDB.
50
MongoDB.Driver.GridFS
GridFS Component of the Official MongoDB .NET Driver.
50
MongoDB.Driver
Official .NET driver for MongoDB.
49
MongoDB.Driver.GridFS
GridFS Component of the Official MongoDB .NET Driver.
49
MongoDB.Driver.GridFS
GridFS Component of the Official MongoDB .NET Driver.
48
MongoDB.Driver.GridFS
GridFS Component of the Official MongoDB .NET Driver.
47
MongoDB.Driver
Official .NET driver for MongoDB.
47

https://github.com/mongodb/mongo-csharp-driver/releases/tag/v2.30.0

Version Downloads Last updated
2.30.0 36 10/19/2024
2.29.0 26 09/19/2024
2.28.0 41 07/25/2024
2.27.0 42 06/28/2024
2.26.0 44 06/13/2024
2.25.0 35 04/21/2024
2.24.0 35 02/27/2024
2.23.2 40 02/27/2024
2.23.1 35 12/19/2023
2.23.0 34 12/19/2023
2.22.0 48 10/19/2023
2.21.0 44 08/11/2023
2.20.0 45 07/01/2023
2.19.2 47 06/04/2023
2.19.1 51 05/01/2023
2.19.0 38 07/12/2023
2.18.0 41 07/11/2023
2.17.1 38 03/28/2023
2.17.0 39 07/18/2023
2.16.1 42 07/19/2023
2.16.0 41 07/28/2022
2.15.1 40 09/04/2022
2.15.0 38 07/11/2023
2.14.1 36 06/23/2023
2.14.0 39 07/18/2023
2.14.0-beta1 44 09/27/2022
2.13.3 40 07/21/2023
2.13.2 63 07/19/2022
2.13.1 40 08/21/2022
2.13.0 41 09/15/2023
2.13.0-beta1 42 07/22/2023
2.12.5 34 07/24/2023
2.12.4 41 06/23/2023
2.12.3 45 07/20/2023
2.12.2 42 07/19/2023
2.12.1 42 07/27/2022
2.12.0 43 10/30/2022
2.12.0-beta1 43 07/04/2023
2.11.6 46 06/11/2022
2.11.5 45 07/24/2023
2.11.4 45 03/15/2023
2.11.3 48 03/01/2023
2.11.2 46 07/28/2022
2.11.1 40 07/16/2023
2.11.0 42 07/16/2023
2.11.0-beta2 40 07/17/2023
2.11.0-beta1 38 07/21/2023
2.10.4 37 07/20/2023
2.10.3 39 07/11/2023
2.10.2 38 07/24/2023
2.10.1 51 07/14/2022
2.10.0 41 04/14/2023
2.10.0-beta1 47 06/23/2023
2.9.3 40 07/11/2023
2.9.2 40 01/10/2023
2.9.1 52 07/18/2023
2.9.0 41 07/21/2023
2.9.0-beta2 44 07/23/2023
2.9.0-beta1 44 07/06/2023
2.8.1 36 02/17/2023
2.8.0 42 10/17/2022
2.7.3 45 07/17/2023
2.7.2 46 07/21/2023
2.7.1 44 07/17/2023
2.7.0 42 12/05/2022
2.7.0-beta0001 35 07/22/2023
2.6.1 46 07/18/2023
2.6.0 41 07/22/2023
2.5.1 48 09/02/2022
2.5.0 39 08/17/2023
2.4.4 43 09/05/2022
2.4.3 44 07/13/2023
2.4.2 39 06/23/2023
2.4.1 44 08/06/2022
2.4.0 38 07/15/2023
2.4.0-beta1 38 12/04/2022
2.3.0 41 07/16/2022
2.3.0-rc1 40 04/10/2023
2.3.0-beta1 39 07/21/2023
2.2.4 41 07/18/2023
2.2.3 37 07/20/2023
2.2.2 39 06/04/2023
2.2.1 39 07/20/2023
2.2.0 48 11/18/2022
2.2.0-rc0 40 07/14/2023
2.1.1 39 07/20/2023
2.1.0 36 07/24/2023
2.1.0-rc1 36 07/13/2023
2.1.0-rc0 44 07/16/2023
2.0.2 44 07/22/2023
2.0.1 44 09/01/2022
2.0.0 42 07/22/2023
2.0.0-rc0 39 07/23/2023
2.0.0-beta4 38 10/08/2022
2.0.0-beta3 38 07/14/2023
2.0.0-beta2 39 07/16/2023
2.0.0-beta1 51 10/05/2022