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.
2,251
MongoDB.Driver
Official .NET driver for MongoDB.
1,955
MongoDB.Driver
Official .NET driver for MongoDB.
944
MongoDB.Driver
Official .NET driver for MongoDB.
842
mongocsharpdriver
This package contains the legacy driver. The new driver's package name is MongoDB.Driver
626
MongoDB.Driver
Official .NET driver for MongoDB.
581
MongoDB.Driver
Official .NET driver for MongoDB.
266
mongocsharpdriver
This package contains the legacy driver. The new driver's package name is MongoDB.Driver
204
MongoDB.Driver
Official .NET driver for MongoDB.
204
mongocsharpdriver
This package contains the legacy driver. The new driver's package name is MongoDB.Driver
121
MongoDB.Driver
Official .NET driver for MongoDB.
120
mongocsharpdriver
This package contains the legacy driver. The new driver's package name is MongoDB.Driver
87
MongoDB.Driver
Official .NET driver for MongoDB.
80
MongoDB.Driver
Official .NET driver for MongoDB.
44
MongoDB.Driver
Official .NET driver for MongoDB.
35
mongocsharpdriver
This package contains the legacy driver. The new driver's package name is MongoDB.Driver
20
mongocsharpdriver
This package contains the legacy driver. The new driver's package name is MongoDB.Driver.
20
mongocsharpdriver
This package contains the legacy driver. The new driver's package name is MongoDB.Driver
19
MongoDB.Driver
Official .NET driver for MongoDB.
19

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

Version Downloads Last updated
2.30.0 2 10/17/2024
2.29.0 5 09/21/2024
2.28.0 7 08/01/2024
2.27.0 8 06/28/2024
2.26.0 7 06/27/2024
2.25.0 9 04/16/2024
2.24.0 7 03/13/2024
2.23.2 8 03/14/2024
2.23.1 74 12/29/2023
2.23.0 11 12/29/2023
2.22.0 842 11/24/2023
2.21.0 20 08/27/2023
2.20.0 11 08/20/2023
2.19.2 9 09/22/2023
2.19.1 9 06/07/2023
2.19.0 7 10/06/2023
2.18.0 12 06/08/2023
2.17.1 7 12/25/2023
2.17.0 8 12/29/2023
2.16.1 261 06/22/2022
2.16.0 2,057 06/16/2022
2.15.1 7 12/29/2023
2.15.0 8 07/27/2023
2.14.1 11 07/06/2023
2.14.0 14 09/13/2023
2.14.0-beta1 9 12/29/2023
2.13.3 10 10/12/2023
2.13.2 2,252 11/12/2021
2.13.1 10 09/27/2021
2.13.0 9 10/08/2023
2.13.0-beta1 9 05/12/2021
2.12.5 8 12/29/2023
2.12.4 10 07/04/2023
2.12.3 943 05/12/2021
2.12.2 13 09/14/2023
2.12.1 7 12/23/2023
2.12.0 117 03/19/2021
2.12.0-beta1 10 11/28/2023
2.11.6 83 03/01/2021
2.11.5 577 12/16/2020
2.11.4 35 12/16/2020
2.11.3 7 08/15/2023
2.11.2 7 12/15/2023
2.11.1 8 10/12/2023
2.11.0 8 06/09/2023
2.11.0-beta2 8 10/08/2023
2.11.0-beta1 8 06/20/2023
2.10.4 8 12/29/2023
2.10.3 14 10/08/2023
2.10.2 9 12/21/2023
2.10.1 6 11/03/2023
2.10.0 8 12/24/2023
2.10.0-beta1 9 10/11/2023
2.9.3 10 11/17/2023
2.9.2 13 10/28/2023
2.9.1 9 10/22/2023
2.9.0 10 06/12/2023
2.9.0-beta2 11 07/28/2023
2.9.0-beta1 9 10/08/2023
2.8.1 36 01/18/2021
2.8.0 9 10/06/2023
2.7.3 11 10/04/2023
2.7.2 10 10/02/2023
2.7.1 8 10/17/2023
2.7.0 11 12/24/2023
2.7.0-beta0001 8 12/29/2023
2.6.1 10 12/29/2023
2.6.0 11 12/17/2023
2.5.1 9 10/09/2023
2.5.0 9 10/09/2023
2.4.4 8 10/20/2023
2.4.3 13 10/26/2023
2.4.2 7 12/16/2023
2.4.1 8 10/28/2023
2.4.0 8 12/29/2023
2.4.0-beta1 7 10/03/2023
2.3.0 13 08/17/2023
2.3.0-rc1 6 10/16/2023
2.3.0-beta1 10 10/31/2023
2.2.4 9 10/31/2023
2.2.3 11 10/11/2023
2.2.2 8 10/11/2023
2.2.1 9 12/24/2023
2.2.0 8 10/14/2023
2.2.0-rc0 7 12/29/2023
2.1.1 9 12/24/2023
2.1.0 10 11/26/2023
2.1.0-rc1 9 10/16/2023
2.1.0-rc0 8 10/17/2023
2.0.2 11 12/30/2023
2.0.1 10 10/12/2023
2.0.0 8 10/18/2023
2.0.0-rc0 11 12/29/2023
2.0.0-beta4 11 10/09/2023
2.0.0-beta3 11 11/05/2023
2.0.0-beta2 12 10/28/2023
2.0.0-beta1 7 12/30/2023