As we want to deploy our app in a production environment, we want our mongod to run in secure mode (--auth). To enable our application the access to mongo we created this user:
Code:
{
"_id" : "sma.sma",
"user" : "sma",
"db" : "sma",
"roles" : [
{
"role" : "dbAdmin",
"db" : "sma"
},
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
]
}
We are unsure about the roles, which are needed for OGM, using the role "userAdminAnyDatabase" would be enough to test the access to our mongo, but we get the following exception:
Code:
Caused by: com.mongodb.CommandFailureException: { "serverUsed" : "localhost:27017" , "ok" : 0.0 , "errmsg" : "not authorized on admin to execute command { listDatabases: 1 }" , "code" : 13}
at com.mongodb.CommandResult.getException(CommandResult.java:76)
at com.mongodb.CommandResult.throwOnError(CommandResult.java:131)
at com.mongodb.Mongo.getDatabaseNames(Mongo.java:397)
at org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider.extractDatabase(MongoDBDatastoreProvider.java:134)
... 29 more
Like in mongo doc described (http://docs.mongodb.org/manual/reference/built-in-roles/) the role has the needed right for the "listDatabases" - operation. Maybe you can help me, thank you in advantage.
Best regards Br3aker