Created
October 9, 2013 23:59
-
-
Save monyskynet/6910697 to your computer and use it in GitHub Desktop.
Increase a field value in mongodb c sharp
From http://stackoverflow.com/questions/10566602/how-do-you-increment-a-field-in-mongodb-using-c-sharp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var query = Query.And(Query.EQ("_id", keyName)); | |
var sortBy = SortBy.Null; | |
var update = Update.Inc("KeyValue", adjustmentAmount); | |
var result = collection.FindAndModify(query, sortBy, update, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment