Permalink
Failed to load latest commit information.
Docs CSHARP-2317: Write reference docs for change streams. Jul 6, 2018
Release Notes Updating release notes for 2.7.0. Jun 27, 2018
Tools CSHARP-2249: Update nuget.exe in Tools\NuGet to current version. Aug 2, 2018
build Update NETStandard.Library dependency to 1.6.1 to match DnsClient. Dec 12, 2017
evergreen CSHARP-2379 Make evergreen compile use diagnostic output for cake com… Sep 12, 2018
src CSHARP-2366: GSSAPI Scram Authentication starts scram conversation wrong Sep 17, 2018
tests CSHARP-2386: Check server in index insertion tests Sep 13, 2018
.gitattributes The MongoDB.Bson.dll and MongoDB.Driver.dll are now strongly named. T… Mar 3, 2011
.gitignore CSHARP-2123: Round up to the next highest integral maxTimeMS instead … Jan 7, 2018
CONTRIBUTING.md CSHARP-578: added contributing doc. Nov 8, 2012
CSharpDriver.Dotnet.sln CSHARP-2044: Migrate project.json files to .csproj Nov 27, 2017
CSharpDriver.sln CSHARP-2124: Automate Atlas connectivity tests. Jul 10, 2018
GitVersion.yml Changed next version number from 2.5.1 to 2.7.0. Apr 20, 2018
License.rtf fixing up some extra 10gen related text. Feb 19, 2014
License.txt Updated copyrights to 20xx-present. Jan 4, 2018
MongoDB.ruleset Reorganize solution directory into src and tests subdirectories. Jun 8, 2016
MongoDBLegacy.ruleset Reorganize solution directory into src and tests subdirectories. Jun 8, 2016
README.md CSHARP-2371: Pin Cake.Git to 0.18.0 Sep 5, 2018
THIRD-PARTY-NOTICES CSHARP-2160: Implement SASLPrep Jun 22, 2018
build.cake CSHARP-2371: Pin Cake.Git to 0.18.0 Sep 5, 2018
build.cmd CSHARP-1707: Modify build scripts to also build and test against .NET… Jul 25, 2016
build.ps1 CSHARP-2249: Fix command monitoring JSON tests against latest server … Jul 27, 2018
build.sh CSHARP-1745: fixed issue with serialization when projecting an embedd… Aug 17, 2016
buildhelpers.cake Updated copyrights to 20xx-present. Jan 4, 2018
uuidhelpers.js Added uuidhelpers.js file with Javascript helper functions to work wi… Nov 18, 2011

README.md

MongoDB C# Driver

You can get the latest stable release from the official Nuget.org feed or from our github releases page.

If you'd like to work with the bleeding edge, you can use our custom feed. Some packages on this feed are pre-release and, while they've passed all our tests, are not yet ready for production.

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.

Maintainers:

Contributors:

If you have contributed and we have neglected to add you to this list please contact one of the maintainers to be added to the list (with apologies).