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
Elastic.Apm.MongoDb
Elastic APM integration with the MongoDB.Driver package.
22
Elastic.Apm.MongoDb
Elastic APM integration with the MongoDB.Driver package.
23
Elastic.Apm.MongoDb
Elastic APM integration with the MongoDB.Driver package.
24
Elastic.Apm.MongoDb
Elastic APM integration with the MongoDB.Driver package.
25
Elastic.Apm.MongoDb
Elastic APM integration with the MongoDB.Driver package.
2,067
MongoDB.Driver
Official .NET driver for MongoDB.
22
MongoDB.Driver
Official .NET driver for MongoDB.
23
MongoDB.Driver
Official .NET driver for MongoDB.
24
MongoDB.Driver
Official .NET driver for MongoDB.
25
MongoDB.Driver
Official .NET driver for MongoDB.
26
MongoDB.Driver
Official .NET driver for MongoDB.
27
MongoDB.Driver
Official .NET driver for MongoDB.
29

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

Version Downloads Last updated
2.30.0 20 11/29/2024
2.29.0 15 12/01/2024
2.28.0 18 11/29/2024
2.27.0 16 12/02/2024
2.26.0 16 12/02/2024
2.25.0 18 04/16/2024
2.24.0 15 11/14/2024
2.23.2 22 05/30/2024
2.23.1 19 05/30/2024
2.23.0 18 05/30/2024
2.22.0 16 05/30/2024
2.21.0 21 05/30/2024
2.20.0 17 05/21/2024
2.19.2 19 06/19/2023
2.19.1 18 05/30/2024
2.19.0 22 07/13/2023
2.18.0 16 05/30/2024
2.17.1 17 05/21/2024
2.17.0 20 05/21/2024
2.16.1 18 05/21/2024
2.16.0 20 05/21/2024
2.14.0 16 06/09/2022
2.14.0-beta1 16 06/09/2022
2.13.3 12 12/10/2024
2.13.1 15 05/30/2024
2.13.0 19 05/30/2024
2.13.0-beta1 15 05/30/2024
2.12.0 20 05/30/2024
2.11.0-beta2 20 05/30/2024
2.10.4 17 06/09/2022
2.9.0 15 05/30/2024
2.5.1 17 06/09/2022
2.5.0 19 07/08/2022
2.3.0-rc1 22 06/09/2022
2.2.4 18 05/30/2024
2.0.0 19 05/30/2024
2.0.0-beta3 19 05/21/2024
2.0.0-beta1 21 06/09/2022