C# CSS Visual Basic JavaScript HTML F#
Permalink
Failed to load latest commit information.
Docs CSHARP-1910: Fix documentation that refers to SetRepresentation metho… Feb 13, 2017
Release Notes Bumping version post release. Feb 2, 2017
Tools CSHARP-1845: Run test matrix on .NET 4.5 on Windows in Evergreen. Feb 14, 2017
build Bumping version post release. Feb 2, 2017
evergreen CSHARP-1845: Remove framework axis. Feb 15, 2017
src CSHARP-1919: Render filters using underlying field serializer when no… Feb 13, 2017
tests CSHARP-1845: Skip tests that require text commands to be enabled on 2.4. Feb 16, 2017
.gitattributes The MongoDB.Bson.dll and MongoDB.Driver.dll are now strongly named. T… Mar 3, 2011
.gitignore CSHARP-1733: fixing dependencies and versioning. Aug 15, 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 14, 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 Added Vyacheslav Stroy as a contributor. Feb 13, 2017
appveyor.yml minor changes for 2.1.0-rc1 release. Oct 7, 2015
build.cake CSHARP-1845: Remove framework axis. Feb 15, 2017
build.cmd CSHARP-1707: Modify build scripts to also build and test against .NET… Jul 25, 2016
build.ps1 CSHARP-1843: Compile .NET driver in Evergreen. Jan 4, 2017
build.sh CSHARP-1745: fixed issue with serialization when projecting an embedd… Aug 17, 2016
buildhelpers.cake CSHARP-1843: Compile .NET driver in Evergreen. Jan 4, 2017
global.json CSHARP-1733: fixing dependencies and versioning. Aug 15, 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:

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