C# CSS Visual Basic JavaScript HTML F#
Failed to load latest commit information.
Docs Update expressions.md (#241) Jun 8, 2016
Release Notes Bumping version post release. Jan 8, 2016
Tools/NuGet CSHARP-1684: Update Tools/NuGet to v3.4.4. Jun 7, 2016
build CSHARP-1707: Build XML docs for .NET Core build. Jul 25, 2016
src CSHARP-1707: Build XML docs for .NET Core build. Jul 25, 2016
tests CSHARP-1707: Switch to using standard NETSTANDARD1_6 preprocessor sym… Jul 21, 2016
.gitattributes The MongoDB.Bson.dll and MongoDB.Driver.dll are now strongly named. T… Mar 2, 2011
.gitignore CSHARP-1707: Modify build scripts to also build and test against .NET… Jul 24, 2016
CONTRIBUTING.md CSHARP-578: added contributing doc. Nov 8, 2012
CSharpDriver.Dotnet.sln CSHARP-1565: Build and test MongoDB.Driver.GridFS against .NET Core Jul 13, 2016
CSharpDriver.sln CSHARP-1564: Build and test MongoDB.Driver.Legacy against .NET Core. Jul 13, 2016
License.rtf fixing up some extra 10gen related text. Feb 19, 2014
License.txt fixing up some extra 10gen related text. Feb 19, 2014
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 removed travis and build status as they were never accurate. Mar 14, 2016
appveyor.yml minor changes for 2.1.0-rc1 release. Oct 7, 2015
build.cmd CSHARP-1707: Modify build scripts to also build and test against .NET… Jul 25, 2016
build.sh CSHARP-1139: Use NuGet to manage our dependency on NUnit. Apr 3, 2015
global.json CSHARP-1561: Build and test MongoDB.Bson against .NET Core. Jun 24, 2016
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 (in alphabetical order):

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).