You can construct queries i c# using the fluent Query interface. Those query can then be fired towards the databse using the Find method on a Mongo collection. E.g:
var myDatabase = MongoDatabase.Create(connectionString);
var myCollection = database.GetCollection<MyType>("myCollectionNameInDB");
var myCollection =
var myQuery = Query.EQ("name", "joe");
var someDataFromDB = myCollection.Find(myQuery).FirstOrDefault();
Query can also be used with updates. E.g.:
myCollection.Update(
myQuery,
Update.Replace(new MyType(){...}),
UpdateFlags.Upsert
);
This just replaced the whole document. For finegrained control you can use the Update API combined with the FindAndModify method. E.g:
var myUpdate = Update.Inc("n", 1);
var result = myCollection.FindAndModify(
myQuery,
SortBy.Descending("name");
myUpdate,
true // return new document
);
Check out http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial for more information.