Skip to content

Node.js based forum software built for the modern web

closes #5517

barisusakli5e0de4b8fbed
diff --git a/src/database/mongo.js b/src/database/mongo.js
index bb3d9f05c2..8e6494ffd7 100644
--- a/src/database/mongo.js
+++ b/src/database/mongo.js
@@ -47,13 +47,8 @@
module.init = function (callback) {
callback = callback || function () { };
- var mongoClient;
- try {
- mongoClient = require('mongodb').MongoClient;
- } catch (err) {
- winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message);
- return callback(err);
- }
+
+ var mongoClient = require('mongodb').MongoClient;
var usernamePassword = '';
if (nconf.get('mongo:username') && nconf.get('mongo:password')) {
@@ -90,7 +85,7 @@
},
};
- connOptions = _.deepExtend((nconf.get('mongo:options') || {}), connOptions);
+ connOptions = _.deepExtend(connOptions, nconf.get('mongo:options') || {});
mongoClient.connect(connString, connOptions, function (err, _db) {
if (err) {
@@ -110,10 +105,7 @@
if (nconf.get('mongo:password') && nconf.get('mongo:username')) {
db.authenticate(nconf.get('mongo:username'), nconf.get('mongo:password'), function (err) {
- if (err) {
- return callback(err);
- }
- callback();
+ callback(err);
});
} else {
winston.warn('You have no mongo password setup!');