C# CSS Visual Basic JavaScript HTML F#
Latest commit d02772d Jan 19, 2017 @rstam rstam Created evergreen directory
Permalink
Failed to load latest commit information.
Docs Remove extra 'status = "current"' lines from releases.toml. Jan 11, 2017
Release Notes Bumping version post release. Jan 4, 2017
Tools CSHARP-1843: Compile .NET driver in Evergreen. Jan 4, 2017
build Bumping version post release. Jan 4, 2017
evergreen Created evergreen directory Jan 19, 2017
src Fix copyrights. Jan 6, 2017
tests Fix copyrights. Jan 6, 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 CSHARP-1836: Added Maksim Krautsou to the contributors list in README… Dec 7, 2016
appveyor.yml minor changes for 2.1.0-rc1 release. Oct 7, 2015
build.cake CSHARP-1843: Compile .NET driver in Evergreen. Jan 4, 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).