I have this code
var mongodb = require('mongodb'), assert = require('assert');
var Db = mongodb.Db;
var db = new Db('local', new Server('localhost', 27017);
db.open(functioin(err, db){
if(err) throw err;
var adminDb = db.admin();
adminDb.listDatabases(function(err, dbs){
if(err) throw err;
console.log(dbs);
});
});
I want to export the dbs variable from the callback of the listDatabases
function.
Is there any way?