You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Ferdinando Papale b9ceea017c Removed unused 5 days ago
.github/workflows CSHARP-4918: Release notes automation (#1701) 2 months ago
Release Notes Add v3.2.1 release notes. (#1620) 5 months ago
apidocs CSHARP-5325: Fix namespaces in docs (#1499) 10 months ago
benchmarks/MongoDB.Driver.Benchmarks CSHARP-5203: Benchmark Collection and Client bulkWrite (#1550) 7 months ago
evergreen CSHARP-5585: Remove reliance on Evergreen instance profile credentials (#1704) 2 months ago
specifications Added uri options test for proxy options 1 month ago
src Removed unused 5 days ago
tests Small improvements 5 days ago
tools CSHARP-2088: Publish PDBs and sources on symbolsource. (#694) 4 years ago
.editorconfig CSHARP-5560: CSOT: Refactor IOperationExecutor to use operation context (#1676) 2 months ago
.gitattributes The MongoDB.Bson.dll and MongoDB.Driver.dll are now strongly named. They are signed using a TemporaryKeyPair. Official binaries will be resigned using a different strong name key. 15 years ago
.gitignore CSHARP-4912: Refactor CSFLE library to separate package (#1423) 10 months ago
CODEOWNERS CSHARP-4750: Added global CODEOWNERS file. (#1160) 2 years ago
CONTRIBUTING.md CSHARP-4124: Replaced docs.mongodb.com with www.mongodb.com/docs and similar URL redirect fixes. (#782) 3 years ago
CSharpDriver.sln CSHARP-5313: rename libmongocrypt project (#1483) 10 months ago
CSharpDriver.sln.DotSettings CSHARP-5512: Convert LINQ-related tests to use fixtures. (#1627) 5 months ago
GitVersion.yml Bump version after release 2 years ago
LICENSE.md CSHARP-4667: Updated license file to include full Apache 2.0 license text rather than just the header. 2 years ago
MongoDB.Driver.snk CSHARP-1276: Provide Strong-Named Assemblies (#1393) 1 year ago
MongoDB.ruleset CSHARP-2750: Upgrade to C# 9 5 years ago
MongoDBLegacy.ruleset CSHARP-2174: Use a single solution and set of project files to multi target .NET Framework and .NET Standard. 7 years ago
MongoDBLegacyTest.ruleset CSHARP-2174: Use a single solution and set of project files to multi target .NET Framework and .NET Standard. 7 years ago
MongoDBTest.ruleset CSHARP-2174: Use a single solution and set of project files to multi target .NET Framework and .NET Standard. 7 years ago
README.md CSHARP-5583: Update README.md (#1681) 3 months ago
THIRD-PARTY-NOTICES CSHARP-4271: Replace Snappy and Zstd with managed implementations 3 years ago
build.cake CSHARP-5592: Separate unit tests into dedicated variants (#1695) 2 months ago
build.config CSHARP-5087 Bump MacOS version used for tests (#1324) 1 year ago
build.ps1 CSHARP-5591: Configure MongoDB.Driver.Encryption.Tests to run on net472 target (#1692) 2 months ago
build.sh CSHARP-5591: Configure MongoDB.Driver.Encryption.Tests to run on net472 target (#1692) 2 months ago
packageIcon.png CSHARP-4921: Improve Nuget packages hygiene (#1386) 1 year ago
purls.txt CSHARP-5469: Support $lookup in CSFLE and QE (#1626) 5 months ago
sbom.json CSHARP-5469: Support $lookup in CSFLE and QE (#1626) 5 months ago

README.md

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.