update server code to work with updated mongoose version

This commit is contained in:
Cassie Tarakajian 2019-11-07 13:38:02 -05:00
parent cee9fa7441
commit a4a01cef4c
1 changed files with 2 additions and 1 deletions

View File

@ -122,7 +122,8 @@ require('./config/passport');
// Connect to MongoDB
mongoose.Promise = global.Promise;
mongoose.connect(mongoConnectionString, { useMongoClient: true });
mongoose.connect(mongoConnectionString, { useNewUrlParser: true, useUnifiedTopology: true });
mongoose.set('useCreateIndex', true);
mongoose.connection.on('error', () => {
console.error('MongoDB Connection Error. Please make sure that MongoDB is running.');
process.exit(1);