Created
October 11, 2012 12:19
-
-
Save jiangzhuo/3871958 to your computer and use it in GitHub Desktop.
MongoDb Update $inc
This file contains 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 = ((MongoQueryable<TEntity>)this.collection.AsQueryable<TEntity>().Where(predicate)).GetMongoQuery(); | |
var memberInitExpression = updateExpression.Body as MemberInitExpression; | |
foreach (MemberBinding binding in memberInitExpression.Bindings) | |
{ | |
string propertyName = binding.Member.Name; | |
} | |
var update = MongoDB.Driver.Builders.Update.Inc(updateExpression.Body.ToString(),1); | |
this.collection.Update(query, update); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment