Last active
September 29, 2017 17:05
-
-
Save NMZivkovic/52e63d08abcd73a513f22983bcc89a1b 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<List<User>> GetAllUsers() | |
{ | |
return await _usersCollection.Find(new BsonDocument()).ToListAsync(); | |
} | |
public async Task<List<User>> GetUsersByField(string fieldName, string fieldValue) | |
{ | |
var filter = Builders<User>.Filter.Eq(fieldName, fieldValue); | |
var result = await _usersCollection.Find(filter).ToListAsync(); | |
return result; | |
} | |
public async Task<List<User>> GetUsers(int startingFrom, int count) | |
{ | |
var result = await _usersCollection.Find(new BsonDocument()) | |
.Skip(startingFrom) | |
.Limit(count) | |
.ToListAsync(); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment