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.
 
 
 
Oleksandr Poliakov 3b1dc42e51
CSHARP-5661: Fix UnobservedTaskException on socket connecting timeout (#1742)
4 days 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-4918: Release notes automation (#1677) 3 months ago
specifications CSHARP-5372: Sync tests for null insert/upsert _id values (#1666) 4 months ago
src CSHARP-5661: Fix UnobservedTaskException on socket connecting timeout (#1742) 4 days ago
tests CSHARP-5661: Fix UnobservedTaskException on socket connecting timeout (#1742) 4 days ago
tools CSHARP-2088: Publish PDBs and sources on symbolsource. (#694) 4 years ago
.editorconfig CSHARP-4765: CI script to generate Driver's dev-package (#1169) 2 years 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-4921: Improve Nuget packages hygiene (#1386) 1 year ago
THIRD-PARTY-NOTICES CSHARP-4271: Replace Snappy and Zstd with managed implementations 3 years ago
build.cake CSHARP-5402: Add missing reference for MongoDB.Driver.Encryption.Test project (#1537) 9 months ago
build.config CSHARP-5087 Bump MacOS version used for tests (#1324) 1 year ago
build.ps1 Set open files limit manually for MacOS-14-arm. (#1331) 1 year ago
build.sh CSHARP-5538: Fix dotnet installation script on Mac and Linux (#1645) 4 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

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.