This is a simplified version of the problem, but basically I'm trying to open 2 mongodb connections with mongoose and it's giving me "Trying to open unclosed connection." error.
var db1 = require('mongoose');
var db2 = require('mongoose');
connect() opens the default connection to the db. Since you want two different connections, use