0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 19:42:43 +00:00

Migrate Mongoose to v6

This commit is contained in:
Trevor Buckner
2021-09-15 14:15:44 -04:00
parent 570c1a9b5f
commit 0e4c830435
3 changed files with 248 additions and 206 deletions

View File

@@ -72,10 +72,11 @@ const config = require('nconf')
//DB
const mongoose = require('mongoose');
mongoose.connect(config.get('mongodb_uri') || config.get('mongolab_uri') || 'mongodb://localhost/naturalcrit',
{ retryWrites: false, useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true });
mongoose.connection.on('error', ()=>{
{ retryWrites: false });
mongoose.connection.on('error', (err)=>{
console.log('Error : Could not connect to a Mongo Database.');
console.log(' If you are running locally, make sure mongodb.exe is running.');
console.log(err);
throw 'Can not connect to Mongo';
});