I have problem using play-reactivemongo to connect to MongoDB 3 and encountered the "'not authorized for query on XXX' (code = 13)" problem. The program ran perfectly ok when MongoDB was started without --auth.
The database version should be 3.0.4, as shown in the log.
2015-10-24T15:58:09.868+0800 I CONTROL [initandlisten] db version v3.0.4
I have used version 0.11.7 play2-reactivemongo plugin.
libraryDependencies ++= Seq(
"org.reactivemongo" %% "play2-reactivemongo" % "0.11.7.play24",
I have specified the authMode in the mongodb.uri like this.
mongodb.uri = "mongodb://postsUser:12345678@localhost:27017/posts?authMode=?authMode=scram-sha1&authSource=posts&rm.tcpNoDelay=true"
I found the following error in mongodb.log.
2015-10-24T16:41:24.977+0800 I ACCESS [conn105] Failed to authenticate postsUser@posts with mechanism MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document
Why MONGODB-CR is used instead of SCRAM-SHA-1? Suppose SCRAM-SHA-1 should be default, right?