express-rest-boilerplate
express-rest-boilerplate copied to clipboard
How would you do to connect to multiple Mongoose URI
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,