mongoose switch database code example
Example: mongoose switching database
// create a connection to a database
var db = mongoose.createConnection(uri);
// use another database without creating additional connections
var db2 = db.useDb('someDbName');
// proceed as you would normally
var Model1 = db.model('Model1', m1Schema);
var Model2 = db2.model('Model2', m2Schema);