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!