3

I have a small connection routine which is as below:

  val dbName = "myDb"
  val user = "myUser"
  val pass = "myPass"

  val mongoDriver = new reactivemongo.api.MongoDriver()

  val db = MyDBObject(
    mongoDriver.connection(
      Seq("XXXXX.mongolab.com:XXXXX"),
      options = MongoConnectionOptions(authMode = ScramSha1Authentication),
      authentications = List(Authenticate(dbName, user, pass))
    ),
    dbName
  )

I'm using this to create a new connection and then using this connection, I work with my documents. But the problem is that for some very strange reason, I could not get this to work!

Here is the error that I get:

CommandError[code=13, errmsg=not authorized on myDb to execute command {....,
  code: BSONInteger(13)
}]

I've been trying to dig into this for almost 3 hours without any vail! The MongoLab uses 3.0 version of MongoDB and I use 0.11.7 version for the ReactiveMongo library.

Using the mongo shell, I'm able to log in to the MongoLab and create new collections with the same set of credentials!

joesan
  • 13,963
  • 27
  • 95
  • 232
  • Per this thread: https://groups.google.com/forum/?fromgroups#!topic/reactivemongo/x3OZ6-hIIXk you'll want to add "?authMode=scram-sha1" to your MongoDB URI – Chris Chang Oct 23 '15 at 20:37
  • authMode = ScramSha1Authentication is added to the MongoConnectionOptions. You can see that in my post above! – joesan Oct 24 '15 at 04:40
  • @sparkr Did you find an answer to your problem? I am breaking my head over the same problem. – Maximus May 20 '16 at 19:53

0 Answers0