async function connect() {
  const mongoServer = new MongoMemoryServer();
  const uri = await mongoServer.getConnectionString();

  const mongooseOpts = {
    useNewUrlParser: true,
    useUnifiedTopology: true,
  };

  await mongoose.connect(uri, mongooseOpts);
  return mongoServer;
}
// Set up in-memory MongoDB.
Set up in-memory MongoDB.
Set up in - memory MongoDB .
async function connect() {
  const mongoServer = new MongoMemoryServer();
  const uri = await mongoServer.getConnectionString();
  const mongooseOpts = {
    useNewUrlParser: true,
    useUnifiedTopology: true,
  };
  await mongoose.connect(uri, mongooseOpts);
  return mongoServer;
}
async function connect ( ) { const mongoServer = new MongoMemoryServer ( ) ; const uri = await mongoServer . getConnectionString ( ) ; const mongooseOpts = { useNewUrlParser : true , useUnifiedTopology : true , } ; await mongoose . connect ( uri , mongooseOpts ) ; return mongoServer ; }
Set up in-memory MongoDB.
Set up in - memory MongoDB .