mongocsharpdriver 2.28.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 mongocsharpdriver.

Packages Downloads
Audit.NET.MongoDB
Mongo DB provider for Audit.NET library
24
Audit.NET.MongoDB
Store Audit.NET Trail Logs into a MongoDB database
24
Audit.NET.MongoDB
Store Audit.NET Trail Logs into a MongoDB database
23
Audit.NET.MongoDB
Store Audit.NET Trail Logs into a MongoDB database
22
Audit.NET.MongoDB
Mongo DB provider for Audit.NET library
22
Audit.NET.MongoDB
Store Audit.NET Trail Logs into a MongoDB database
21
Audit.NET.MongoDB
Mongo DB provider for Audit.NET library
21
Audit.NET.MongoDB
Store Audit.NET Trail Logs into a MongoDB database
20
Audit.NET.MongoDB
Mongo DB provider for Audit.NET library
20
Audit.NET.MongoDB
Store Audit.NET Trail Logs into a MongoDB database
19

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

.NET Framework 4.7.2

.NET Standard 2.0

.NET Standard 2.1

Version Downloads Last updated
2.30.0 27 10/24/2024
2.29.0 20 09/19/2024
2.28.0 21 07/25/2024
2.27.0 25 06/28/2024
2.26.0 39 06/26/2024
2.25.0 38 04/30/2024
2.24.0 25 03/13/2024
2.23.2 30 03/13/2024
2.23.1 24 01/17/2024
2.23.0 20 01/17/2024
2.22.0 24 12/07/2023
2.21.0 21 12/07/2023
2.20.0 22 12/07/2023
2.19.2 20 08/30/2024
2.19.1 22 07/07/2024
2.19.0 19 08/28/2024
2.18.0 23 06/28/2024
2.17.1 21 08/30/2024
2.17.0 22 08/28/2024
2.16.1 17 07/25/2024
2.16.0 23 07/28/2024
2.15.1 20 06/28/2024
2.15.0 20 06/25/2024
2.14.1 21 04/22/2024
2.14.0 22 08/30/2024
2.14.0-beta1 19 02/16/2024
2.13.3 18 08/27/2024
2.13.2 20 03/07/2024
2.13.1 21 08/30/2024
2.13.0 24 08/30/2024
2.13.0-beta1 21 02/16/2024
2.12.5 25 07/30/2024
2.12.4 27 08/30/2024
2.12.3 24 07/20/2024
2.12.2 20 07/25/2024
2.12.1 22 08/30/2024
2.12.0 21 07/30/2024
2.12.0-beta1 21 09/28/2023
2.11.6 23 07/18/2024
2.11.5 17 10/05/2023
2.11.4 25 03/18/2024
2.11.3 23 08/30/2024
2.11.2 20 12/09/2023
2.11.1 19 08/30/2024
2.11.0 16 10/14/2023
2.11.0-beta2 23 02/16/2024
2.11.0-beta1 22 02/16/2024
2.10.4 16 08/23/2024
2.10.3 22 10/14/2023
2.10.2 18 08/30/2024
2.10.1 21 07/28/2024
2.10.0 16 08/30/2024
2.10.0-beta1 27 02/16/2024
2.9.3 20 01/16/2024
2.9.2 19 08/30/2024
2.9.1 17 08/30/2024
2.9.0 19 12/30/2023
2.9.0-beta2 23 03/22/2024
2.9.0-beta1 25 03/22/2024
2.8.1 23 03/15/2024
2.8.0 17 07/16/2024
2.7.3 20 08/30/2024
2.7.2 22 08/30/2024
2.7.1 21 08/30/2024
2.7.0 23 08/07/2024
2.7.0-beta0001 15 09/08/2023
2.6.1 18 08/30/2024
2.6.0 24 08/14/2024
2.5.1 26 08/22/2024
2.5.0 20 02/16/2024
2.4.4 22 03/19/2024
2.4.3 20 06/23/2024
2.4.2 18 08/30/2024
2.4.1 15 12/30/2023
2.4.0 18 08/30/2024
2.4.0-beta1 22 12/11/2023
2.3.0 20 04/07/2024
2.3.0-rc1 19 06/27/2024
2.3.0-beta1 25 03/22/2024
2.2.4 18 07/31/2024
2.2.3 18 08/03/2024
2.2.2 17 08/30/2024
2.2.1 19 08/29/2024
2.2.0 18 08/27/2024
2.2.0-rc0 21 06/27/2024
2.1.1 19 08/30/2024
2.1.0 29 04/25/2024
2.1.0-rc1 21 06/27/2024
2.1.0-rc0 26 06/27/2024
2.0.2 18 07/25/2024
2.0.1 18 08/06/2024
2.0.0 19 08/30/2024
2.0.0-rc0 20 06/27/2024
2.0.0-beta4 22 03/22/2024
2.0.0-beta3 24 01/17/2024
2.0.0-beta2 22 03/22/2024
2.0.0-beta1 21 03/22/2024
1.11.0 21 07/15/2024
1.11.0-rc0 17 02/19/2024
1.10.1 19 01/22/2024
1.10.0 20 09/08/2023
1.10.0-rc1 24 02/19/2024
1.10.0-rc0 21 02/19/2024
1.9.2 51 11/29/2019
1.9.1 27 08/30/2024
1.9.0 19 08/30/2024
1.8.3 20 08/30/2024
1.8.2 30 06/26/2024
1.8.1 23 08/13/2024
1.8.0 21 08/04/2024
1.7.1 19 08/10/2024
1.7.0 23 03/17/2024
1.6.1 20 08/30/2024
1.6.0 19 12/30/2023
1.5.0 19 01/13/2024
1.4.2 19 08/28/2024
1.4.1 15 08/30/2024
1.4.0 22 07/25/2024
1.3.1 19 06/14/2023
1.3.0 20 08/30/2024
1.2.0 19 08/06/2024
1.1.0 20 08/13/2024
1.0.0 18 07/26/2024
0.11.0.4042 24 03/19/2024