Permalink
Browse files

Do not try to authenticate when using connectionString

Closes #191
  • Loading branch information...
1 parent 2e736d8 commit 2b261362ae9184bd54420b2bc489117078c5786a @fzaninotto committed Nov 3, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 bootstrap.js
View
@@ -12,7 +12,7 @@ mongoose.connection.on('error', function (err) {
mongoose.connection.on('open', function (err) {
mongoose.connection.db.admin().serverStatus(function(err, data) {
if (err) {
- if (err.name === "MongoError" && (err.errmsg === 'need to login' || err.errmsg === 'unauthorized')) {
+ if (err.name === "MongoError" && (err.errmsg === 'need to login' || err.errmsg === 'unauthorized') && !config.mongodb.connectionString) {
console.log('Forcing MongoDB authentication');
mongoose.connection.db.authenticate(config.mongodb.user, config.mongodb.password, function(err) {
if (!err) return;

0 comments on commit 2b26136

Please sign in to comment.