Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit 59a93a8

Browse files
committed
Better error message on initial mongodb connect
1 parent f6679e7 commit 59a93a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/mongoose.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ const path = require('path');
55
module.exports = function () {
66
const app = this;
77

8+
mongoose.Promise = global.Promise;
89
mongoose.connect(app.get('mongodb'), {
910
useMongoClient: true,
1011
autoReconnect: true,
1112
keepAlive: 1,
1213
connectTimeoutMS: 10000,
1314
socketTimeoutMS: 10000
14-
}, function () {
15+
}).then(() => {
1516
if (process.env.NODE_ENV !== 'production' && app.get('seeder').dropDatabase === true) {
1617
mongoose.connection.dropDatabase().then(() => {
1718
app.debug('>>>>>> DROPED DATABASE <<<<<<');
@@ -25,7 +26,8 @@ module.exports = function () {
2526
} else {
2627
app.emit('mongooseInit');
2728
}
29+
},(err) => {
30+
console.log(err);
2831
});
29-
mongoose.Promise = global.Promise;
3032
app.set('mongooseClient', mongoose);
3133
};

0 commit comments

Comments
 (0)