Created
September 29, 2017 17:25
-
-
Save NMZivkovic/d58254a307643aa35863738200667ec2 to your computer and use it in GitHub Desktop.
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
public async Task<bool> DeleteUserById(ObjectId id) | |
{ | |
var filter = Builders<User>.Filter.Eq("_id", id); | |
var result = await _usersCollection.DeleteOneAsync(filter); | |
return result.DeletedCount != 0; | |
} | |
public async Task<long> DeleteAllUsers() | |
{ | |
var filter = new BsonDocument(); | |
var result = await _usersCollection.DeleteManyAsync(filter); | |
return result.DeletedCount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment