Skip to content
Browse files

Merge pull request #131 from outaTiME/master

MongoDB 2.4.1 support
  • Loading branch information...
2 parents ec9b07c + 5ac4a85 commit 0b5da35b82388770f1ea514da0a90f7a34f97cd3 @fzaninotto committed Apr 9, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 bootstrap.js
View
6 bootstrap.js
@@ -10,9 +10,9 @@ mongoose.connection.on('error', function (err) {
process.exit(1);
});
mongoose.connection.on('open', function (err) {
- mongoose.connection.db.admin().serverStatus(function(err, data) {
+ mongoose.connection.db.admin().serverStatus(function(err, data) {
if (err) {
- if (err.name === "MongoError" && err.errmsg === 'need to login') {
+ if (err.name === "MongoError" && (err.errmsg === 'need to login' || err.errmsg === 'unauthorized')) {
console.log('Forcing MongoDB authentication');
mongoose.connection.db.authenticate(config.mongodb.user, config.mongodb.password, function(err) {
if (!err) return;
@@ -33,4 +33,4 @@ mongoose.connection.on('open', function (err) {
});
-module.exports = mongoose;
+module.exports = mongoose;

0 comments on commit 0b5da35

Please sign in to comment.
Something went wrong with that request. Please try again.