Skip to content

Instantly share code, notes, and snippets.

@fractos
Created July 12, 2015 17:28
part 4 updating a list of users in mongodb
static void UpdateUsers(IList<User> users)
using (IUserStore userStore = new MongoDBUserStore(ConnectionString, DatabaseName, CollectionName))
{
userStore.Start();
foreach (User user in users)
{
User updatedUser = user.Mutate(b =>
{
b.Password = // pick a random string from somewhere here
return b;
});
userStore.Put(updatedUser);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment