MongoDB.Bson 3.1.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.Bson.

Packages Downloads
MongoDB.Driver
Official .NET driver for MongoDB.
20
MongoDB.Driver
Official .NET driver for MongoDB.
21
MongoDB.Driver
Official .NET driver for MongoDB.
22
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.
28
MongoDB.Driver.Core
Core Component of the Official MongoDB .NET Driver.
20
MongoDB.Driver.Core
Core Component of the Official MongoDB .NET Driver.
21
MongoDB.Driver.Core
Core Component of the Official MongoDB .NET Driver.
22

https://github.com/mongodb/mongo-csharp-driver/releases/tag/v3.1.0

Version Downloads Last updated
3.4.0 6 05/03/2025
3.3.0 8 03/30/2025
3.2.1 7 03/16/2025
3.2.0 7 03/16/2025
3.1.0 14 12/13/2024
3.0.0 17 11/14/2024
2.30.0 11 11/14/2024
2.29.0 10 12/08/2024
2.28.0 13 11/14/2024
2.27.0 19 11/14/2024
2.26.0 11 12/13/2024
2.25.0 23 05/21/2024
2.24.0 15 05/21/2024
2.23.2 15 05/30/2024
2.23.1 21 05/21/2024
2.23.0 20 05/21/2024
2.22.0 16 05/21/2024
2.21.0 17 05/30/2024
2.20.0 29 05/21/2024
2.19.2 25 06/12/2023
2.19.1 17 04/14/2023
2.19.0 25 06/12/2023
2.18.0 17 06/22/2023
2.17.1 16 05/30/2024
2.17.0 15 05/30/2024
2.16.1 16 05/30/2024
2.16.0 15 06/12/2023
2.14.1 17 06/07/2022
2.14.0-beta1 19 05/30/2024
2.13.3 20 05/30/2024
2.13.0-beta1 20 05/30/2024
2.12.0 20 06/07/2022
2.12.0-beta1 15 05/30/2024
2.11.6 17 06/07/2022
2.11.1 18 05/21/2024
2.11.0-beta1 17 05/30/2024
2.10.3 16 05/30/2024
2.10.2 13 05/30/2024
2.10.0 18 05/30/2024
2.10.0-beta1 17 05/30/2024
2.9.0-beta1 13 05/30/2024
2.7.0-beta0001 19 05/30/2024
2.6.0 17 05/30/2024
2.5.0 15 05/30/2024
2.4.0 18 05/30/2024
2.3.0 21 05/30/2024
2.3.0-rc1 15 05/30/2024
2.3.0-beta1 18 05/30/2024
2.2.1 20 05/30/2024
2.2.0 16 05/30/2024
2.1.0-rc1 14 05/30/2024
2.1.0-rc0 15 05/30/2024
2.0.0-rc0 19 05/30/2024
2.0.0-beta3 17 06/07/2022
2.0.0-beta2 14 05/30/2024
2.0.0-beta1 16 05/30/2024