Skip to content
Browse files

Add support for MongoDB 2.4.1.

  • Loading branch information...
1 parent ec9b07c commit 5ac4a8512d7771bc2256084ce2d4f65e94b6a91d @outaTiME outaTiME committed Apr 5, 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 5ac4a85

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