Created
May 30, 2015 05:22
-
-
Save samsonayalew/f7adaf21145bb9f78a5e 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('test', new Server('localhost', 27017)); | |
// Establish connection to db | |
db.open(function(err, db) { | |
// Use the admin database for the operation | |
var adminDb = db.admin(); | |
// List all the available databases | |
adminDb.listDatabases(function(err, dbs) { | |
assert.equal(null, err); | |
assert.ok(dbs.databases.length > 0); | |
db.close(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment