Created
September 10, 2015 11:39
-
-
Save Scorpiion/44733a13a72d771df1c3 to your computer and use it in GitHub Desktop.
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
Future list(String mongodbUri, String database_name, String collection_name) async { | |
// Default pagination option | |
var limit = 50; | |
var skip = 0; | |
// Create database connection | |
Db db = new Db('$mongodbUri/$database_name'); | |
// Connect | |
await db.open(); | |
// Create coll object | |
var coll = db.collection(collection_name); | |
// Get all documents | |
var documents = await coll.find(where.limit(limit).skip(skip)).toList(); | |
// Close db | |
db.close(); | |
return documents; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment