I recently created an mongolab account on a sandbox platform (so no admin priviledges). I have a simple testcase application to integrate Hibernate OGM + JPA 2.1 with my mongo database. When i try to run my application i get the following error(singnificant part):
Caused by: com.mongodb.CommandFailureException: { "serverUsed" : "ds062797.mongolab.com:62797" , "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:152)
... 34 more
I've done some digging in Hibernate ORM's documentation here and the following lines caught my eye:
The user defined with USERNAME must have the privileges for the creation of a new database. The database will have the name defined with DATABASE. Accepts "true" or "false".
Is there any way I can override this in Hibernate OGM? Or maybe someone used another provider that doesn't have this limitation? (tried to setup eclipselink with no luck)
P.S.: I am aware that i can connect to mongolab with the MongoDB java driver creating a MongoClient, been there done that. I want to stick to an JPA setup.