MongoDB.Bson 3.6.0

MongoDB C# Driver

MongoDB.Driver Documentation Documentation License

The official MongoDB .NET/C# driver.

The MongoDB .NET/C# driver follows semantic versioning since v3.0.0 of its releases.

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.Core
Core Component of the Official MongoDB .NET Driver.
1,394
MongoDB.Driver
Official .NET driver for MongoDB.
1,391
MongoDB.Driver
Official .NET driver for MongoDB.
1,055
MongoDB.Driver.Core
Core Component of the Official MongoDB .NET Driver.
234
MongoDB.Driver
Official .NET driver for MongoDB.
165
MongoDB.Driver.Core
Core Component of the Official MongoDB .NET Driver.
93
MongoDBMigrations
MongoDbMigrations uses the official MongoDB C# Driver to migrate your documents in your mongo database via useful fluent API. Supports up and down migrations with cancelation and progress handling. Also, this library is able to check a schema of collections in your database during the migration run. This version supports on-premise Mongo database either Azure CosmosDB (with Mongo-like API) or even AWS DocumentDB. In addition you can use TLS and/or SHH tunnels in your migrations. PS1 script for integration with CI/CD pipelines provides inside of the repository
64
MongoDB.Driver
Official .NET driver for MongoDB.
64
MongoDB.Driver.Core
Core Component of the Official MongoDB .NET Driver.
64
MongoDBMigrationsRZ
MongoDbMigrations uses the official MongoDB C# Driver to migrate your documents in your mongo database via useful fluent API. Supports up and down migrations with cancelation and progress handling. Also, this library is able to check a schema of collections in your database during the migration run. This version supports on-premise Mongo database either Azure CosmosDB (with Mongo-like API) or even AWS DocumentDB. In addition you can use TLS and/or SHH tunnels in your migrations. PS1 script for integration with CI/CD pipelines provides inside of the repository
49
MongoDB.Driver
Official .NET driver for MongoDB.
49
MongoDB.Driver
Official .NET driver for MongoDB.
42
MongoDB.Driver
Official .NET driver for MongoDB.
12
MongoDB.Driver.Core
Core Component of the Official MongoDB .NET Driver.
4

Version Downloads Last updated
3.7.1 0 03/18/2026
3.7.0 0 03/02/2026
3.6.0 1,118 02/03/2026
3.5.2 0 11/27/2025
3.5.1 0 11/19/2025
3.5.0 13 10/07/2025
3.4.3 0 08/18/2025
3.4.2 101 10/13/2025
3.4.1 0 07/16/2025
3.4.0 0 05/01/2025
3.3.0 0 03/27/2025
3.2.1 0 02/20/2025
3.2.0 0 02/12/2025
3.1.0 49 02/03/2026
3.0.0 42 02/03/2026
2.30.0 0 10/16/2024
2.29.0 0 09/18/2024
2.28.0 93 10/09/2025
2.27.0 0 06/28/2024
2.26.0 0 06/12/2024
2.25.0 0 04/12/2024
2.24.0 1,396 10/03/2025
2.23.2 0 02/20/2024
2.23.1 0 12/15/2023
2.23.0 0 12/11/2023
2.22.0 0 10/09/2023
2.21.0 0 08/10/2023
2.20.0 0 06/21/2023
2.19.2 0 05/25/2023
2.19.1 0 03/27/2023
2.19.0 234 10/08/2025
2.18.0 0 10/14/2022
2.17.1 0 07/30/2022
2.17.0 0 07/18/2022
2.16.1 0 06/21/2022
2.16.0 0 06/07/2022
2.15.1 0 05/04/2022
2.15.0 0 03/09/2022
2.14.1 64 10/08/2025
2.14.0 0 11/24/2021
2.14.0-beta1 0 10/15/2021
2.13.3 0 11/23/2021
2.13.2 0 10/06/2021
2.13.1 0 08/04/2021
2.13.0 0 07/13/2021
2.13.0-beta1 0 03/31/2021
2.12.5 0 11/20/2021
2.12.4 0 06/04/2021
2.12.3 0 05/04/2021
2.12.2 0 04/07/2021
2.12.1 0 03/23/2021
2.12.0 0 03/03/2021
2.12.0-beta1 0 11/06/2020
2.11.6 0 01/20/2021
2.11.5 0 12/02/2020
2.11.4 0 11/04/2020
2.11.3 0 10/15/2020
2.11.2 0 09/10/2020
2.11.1 0 08/25/2020
2.11.0 0 07/30/2020
2.11.0-beta2 0 06/10/2020
2.11.0-beta1 0 04/10/2020
2.10.4 0 05/05/2020
2.10.3 0 04/07/2020
2.10.2 0 02/14/2020
2.10.1 0 01/15/2020
2.10.0 0 12/10/2019
2.10.0-beta1 0 10/02/2019
2.9.3 0 11/08/2019
2.9.2 0 09/30/2019
2.9.1 0 08/21/2019
2.9.0 0 08/15/2019
2.9.0-beta2 0 06/17/2019
2.9.0-beta1 0 03/13/2019
2.8.1 0 05/15/2019
2.8.0 0 03/13/2019
2.7.3 0 01/24/2019
2.7.2 0 11/10/2018
2.7.1 0 11/08/2018
2.7.0 0 06/27/2018
2.7.0-beta0001 0 04/22/2018
2.6.1 0 05/17/2018
2.6.0 0 04/24/2018
2.5.1 0 04/19/2018
2.5.0 0 12/12/2017
2.4.4 4 10/09/2025
2.4.3 0 03/09/2017
2.4.2 0 02/02/2017
2.4.1 0 01/04/2017
2.4.0 0 11/29/2016
2.4.0-beta1 0 10/05/2016
2.3.0 0 09/23/2016
2.3.0-rc1 0 08/29/2016
2.3.0-beta1 0 08/03/2016
2.2.4 0 05/18/2016
2.2.3 0 02/02/2016
2.2.2 0 01/15/2016
2.2.1 0 01/08/2016
2.2.0 0 12/07/2015
2.2.0-rc0 0 11/18/2015
2.1.1 0 11/11/2015
2.1.0 0 10/19/2015
2.1.0-rc1 0 10/07/2015
2.1.0-rc0 0 09/17/2015
2.0.2 0 11/11/2015
2.0.1 0 06/08/2015
2.0.0 0 04/02/2015
2.0.0-rc0 0 03/17/2015
2.0.0-beta4 0 03/09/2015
2.0.0-beta3 0 03/05/2015
2.0.0-beta2 0 02/04/2015
2.0.0-beta1 0 01/16/2015