Created
May 30, 2015 07:19
-
-
Save samsonayalew/d20b17f82a2b45161100 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
var db = new Db('local', new Server('localhost', 27017)); | |
module.exports.dbs = exports.dbs; | |
exports.dbs = function(callback){ | |
db.open(function(err, db){ | |
if(err) callback(err); | |
var adminDb = db.admin(); | |
adminDb.listDatabases(function(err, dbs){ | |
if(err) callback(err); | |
db.close(); | |
callback(null, dbs); | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment