Permalink
Browse files

authentication now occurs after client properly opened

  • Loading branch information...
1 parent 8489cbc commit 69ffca28cde7de96b411b5de42ab54e5aa9d4790 @dgreisen dgreisen committed Oct 19, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/server/db/mongo.coffee
@@ -32,7 +32,10 @@ module.exports = MongoDb = (options) ->
client = options.client or new mongodb.Db(options.db, new mongodb.Server(options.hostname, options.port, options.mongoOptions))
if options.user and options.password
- client.auth(options.user, options.password)
+ client.open (err, db) ->
+ if not err
+ client = db
+ client.authenticate(options.user, options.password)
opsCollectionForDoc = (docName) -> 'ops.' + encodeURIComponent(docName).replace(/\./g, '%2E').replace(/-/g, '%2D')

0 comments on commit 69ffca2

Please sign in to comment.