-
Notifications
You must be signed in to change notification settings - Fork 82
Home
h3.MongoSharp is a .Net library for connecting to the Document-oriented MongoDB.
General goals include
- Strongly-typed interaction when querying and updating collections.
- Improved interface to send common Mongo commands (creating indices, getting all the existing dbs and collections, etc.).
- Ultra-fast de/serialization of BSON to .Net CLR types and back.
- Fluent-like interaction with Mongo collections.
- LINQ-to-Mongo
Getting started with MongoSharp can be as easy as this:
//open collection
@var coll = (new MongoContext()).GetDatabase("benchmark").GetCollection<GeneralDTO>("test");
//create a new object to be added to the collection
@var obj = new GeneralDTO();
obj._id = BSONOID.NewOID();
obj.Title = "ABCDEFG";
obj.Incremental = 1;
@//save the object
@coll.Insert(obj);
@//find the object
@var obj2 = coll.Find(new { id = obj.id}).First();
We’ve made some important decisions that you should be aware of:
BSON Serializer
MongoFlyweight