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.
 
 
 
rstam ca55ac4cb0 Release notes for 2.4.2. 9 years ago
Docs Remove extra 'status = "current"' lines from releases.toml. 9 years ago
Release Notes Release notes for 2.4.2. 9 years ago
Tools CSHARP-1843: Compile .NET driver in Evergreen. 9 years ago
build Bumping version post release. 9 years ago
evergreen Set required environment variables in evergreen.yml. 9 years ago
src CSHARP-1891: Code review changes. 9 years ago
tests CSHARP-1891: Further changes to Distinct for backward compatibility. 9 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-1733: fixing dependencies and versioning. 9 years ago
CONTRIBUTING.md CSHARP-578: added contributing doc. 13 years ago
CSharpDriver.Dotnet.sln CSHARP-1565: Build and test MongoDB.Driver.GridFS against .NET Core 9 years ago
CSharpDriver.sln CSHARP-1564: Build and test MongoDB.Driver.Legacy against .NET Core. 9 years ago
License.rtf fixing up some extra 10gen related text. 12 years ago
License.txt fixing up some extra 10gen related text. 12 years ago
MongoDB.ruleset Reorganize solution directory into src and tests subdirectories. 9 years ago
MongoDBLegacy.ruleset Reorganize solution directory into src and tests subdirectories. 9 years ago
README.md CSHARP-1836: Added Maksim Krautsou to the contributors list in README.md. 9 years ago
appveyor.yml minor changes for 2.1.0-rc1 release. 10 years ago
build.cake CSHARP-1843: Compile .NET driver in Evergreen. 9 years ago
build.cmd CSHARP-1707: Modify build scripts to also build and test against .NET Core. 9 years ago
build.ps1 CSHARP-1843: Compile .NET driver in Evergreen. 9 years ago
build.sh CSHARP-1745: fixed issue with serialization when projecting an embedded array. 9 years ago
buildhelpers.cake CSHARP-1843: Compile .NET driver in Evergreen. 9 years ago
global.json CSHARP-1733: fixing dependencies and versioning. 9 years ago
uuidhelpers.js Added uuidhelpers.js file with Javascript helper functions to work with the various encoding of UUIDs in the mongo shell. These will eventually be obsoleted when SERVER-3153 is implemented. 14 years 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.

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