express-rest-boilerplate icon indicating copy to clipboard operation
express-rest-boilerplate copied to clipboard

How would you do to connect to multiple Mongoose URI

Open llccrr opened this issue 3 years ago • 0 comments

Hello, I love the way you are declaring the mongo connection inside a loader, well injected. However I was wondering how you would do if you wanted to instantiate two different connections ? Usually, the right way of declaring two connection would be :

const conn1 = mongoose.createConnection(uri1);
const conn2 = mongoose.createConnection(uri2);

Then import these connections directly from the model files, do you know anyway of doing that while keeping the pattern you are using in this boilerplate ?

Thanks for the boilerplate,

llccrr avatar Jan 10 '22 11:01 llccrr