You can get the latest stable release from the official Nuget.org feed or from our github releases page.
usingMongoDB.Bson;usingMongoDB.Driver;
varclient=newMongoClient("mongodb://localhost:27017");vardatabase=client.GetDatabase("foo");varcollection=database.GetCollection<BsonDocument>("bar");awaitcollection.InsertOneAsync(newBsonDocument("Name","Jack"));varlist=awaitcollection.Find(newBsonDocument("Name","Jack")).ToListAsync();foreach(vardocumentinlist){Console.WriteLine(document["Name"]);}
usingMongoDB.Bson;usingMongoDB.Driver;
publicclassPerson{publicObjectIdId{get;set;}publicstringName{get;set;}}
varclient=newMongoClient("mongodb://localhost:27017");vardatabase=client.GetDatabase("foo");varcollection=database.GetCollection<Person>("bar");awaitcollection.InsertOneAsync(newPerson{Name="Jack"});varlist=awaitcollection.Find(x =>x.Name=="Jack").ToListAsync();foreach(varpersoninlist){Console.WriteLine(person.Name);}
If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here.
Please see our guidelines for contributing to the driver.
Thank you to everyone who has contributed to this project.