Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created September 29, 2017 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/518aaf1a0596349a037e942f4484a2b0 to your computer and use it in GitHub Desktop.
Save NMZivkovic/518aaf1a0596349a037e942f4484a2b0 to your computer and use it in GitHub Desktop.
public async Task<bool> UpdateUser(ObjectId id, string udateFieldName, string updateFieldValue)
{
var filter = Builders<User>.Filter.Eq("_id", id);
var update = Builders<User>.Update.Set(udateFieldName, updateFieldValue);
var result = await _usersCollection.UpdateOneAsync(filter, update);
return result.ModifiedCount != 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment