jest mongoose multiple connections

Solutions on MaxInterview for jest mongoose multiple connections by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "jest mongoose multiple connections"
Luis
29 Feb 2017
1import mongoose from 'mongoose';
2
3const opts = { useMongoClient: true }; // remove this option if you use mongoose 5 and above
4const conn = mongoose.createConnection(); // just create connection instance
5const User = conn.model('User', new mongoose.Schema({ name: String })); // define model
6conn.open(uri, opts); // open connection to database (NOT `connect` method!)