0

I have added authorization to my Mongo database and now I can't perform any queries whats so ever.

Every time I try I get:

reactivemongo.core.commands.DefaultCommandError: BSONCommandError['command failed because the 'ok' field is missing or equals 0'] with original doc { ok: BSONDouble(0.0), errmsg: BSONString(unauthorized) }

And my Authorization bit seams to be alright but it is just not doing the job:

private val driver = new MongoDriver(actorSystem)
private val dbName = "myDatabase"
private val userName = "root"
private val password = "pass"
private val credentials = Seq(Authenticate(dbName, userName, password))
private val connection = driver.connection(List("111.111.111.11"), credentials)
//connection.authenticate(dbName, userName, password)
private val db = connection(dbName)

The user credentials were created Any ideas on what is wrong here?

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
PovilasID
  • 883
  • 10
  • 34

1 Answers1

0

Apparently unauthorized means not that I has not logged in it means that the user does not have sufficient permissions or Roles as they are grouped in Mongo.

Some tutorials about adding authorization have skipped that part er go I get to relearn the lesson of reading an official documentation of any resource again... http://docs.mongodb.org/manual/reference/method/db.addUser/

PovilasID
  • 883
  • 10
  • 34