how to create and use a class in c# (with mongodb)
just learning c#. I am using the below code over and over again in my code
and believe I should create a class but not sure how to structure it...
Any help appreciated:
MongoServer mongo = MongoServer.Create();
mongo.Connect();
var db = mongo.GetDatabase("forms");
mongo.RequestStart(db);
var collection = db.GetCollection("forms");
var query = new QueryDocument("_id",ObjectId.Parse(Id));
var resultsCursor = collection.Find(query);
thanks in advance!
No comments:
Post a Comment