com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'not authorized for query on ..."

6,907 views
Skip to first unread message

Ravi Kumar Papisetti

unread,
Jun 2, 2015, 7:52:02 PM6/2/15
to mongod...@googlegroups.com
Hi,

MongoDB version 3.x

Spring 4.1.6, mongo-java-driver - 3.0.2, spring-data-commons - 1.10.0.RELEASE, spring-data-mongodb - 1.7.0.RELEASE

Unable to run the find query on a collection.

I am able to view the collection on GUI using same credentials.

Any help would be appreciated.

Here is the full exception:
org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 13 and error message 'not authorized for query on <db.table>' on server xxx; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'not authorized for query on db.table on server xxx
    at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:96)
    at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2002)
    at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1885)

Thanks,
Ravi Kumar P.

Vivek Agrawal

unread,
Jul 18, 2015, 10:27:29 PM7/18/15
to mongod...@googlegroups.com
Hi,
Did you get the solution for this?
I am also using the same dependencies and getting the same problem.

Jeff Yemin

unread,
Jul 26, 2015, 9:52:11 PM7/26/15
to mongodb-user, ravi.pa...@gmail.com
Hi Ravi,

Can you please post your MongoClient configuration for SpringData MongoDB?  It's possible that you're not properly setting the credentials and therefore getting an authorization (rather than an authentication) error.


Regards,
Jeff

psp...@gmail.com

unread,
Feb 24, 2016, 2:27:45 AM2/24/16
to mongodb-user
Hi ,

I am also facing same issue. Does anyone has resolution for this?

Regards,
Prakash

Atnakus Arzah

unread,
Feb 25, 2016, 2:12:03 AM2/25/16
to mongodb-user
I don't have a concrete answer, however, based purely on the exception,
it looks like an issue related to privileges. You could try reading
about that here:

https://docs.mongodb.org/manual/tutorial/manage-users-and-roles/



--
Atnakus Arzah <atnaku...@gmail.com>

When in doubt, have a cookie!

signature.asc
Reply all
Reply to author
Forward
0 new messages