org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 13 and error message 'not authorized on NEWTest to execute command { find: "usersD", filter: { username: "Dhara" }, limit: 1, singleBatch: true }' on server 127.0.0.1:27017; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'not authorized on NEWTest to execute command { find: "usersD", filter: { username: "Dhara" }, limit: 1, singleBatch: true }' on server 127.0.0.1:27017

Stack Overflow | Noob101 | 9 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Query failed with error code 13 and error message 'not authorized on [db] to execute command { find:

    Stack Overflow | 9 months ago | Noob101
    org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 13 and error message 'not authorized on NEWTest to execute command { find: "usersD", filter: { username: "Dhara" }, limit: 1, singleBatch: true }' on server 127.0.0.1:27017; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'not authorized on NEWTest to execute command { find: "usersD", filter: { username: "Dhara" }, limit: 1, singleBatch: true }' on server 127.0.0.1:27017

    Root Cause Analysis

    1. com.mongodb.MongoQueryException

      Query failed with error code 13 and error message 'not authorized on NEWTest to execute command { find: "usersD", filter: { username: "Dhara" }, limit: 1, singleBatch: true }' on server 127.0.0.1:27017

      at com.mongodb.operation.FindOperation$1.call()
    2. MongoDB Java Driver
      DBCollection.findOne
      1. com.mongodb.operation.FindOperation$1.call(FindOperation.java:492)
      2. com.mongodb.operation.FindOperation$1.call(FindOperation.java:482)
      3. com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:239)
      4. com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:212)
      5. com.mongodb.operation.FindOperation.execute(FindOperation.java:482)
      6. com.mongodb.operation.FindOperation.execute(FindOperation.java:79)
      7. com.mongodb.Mongo.execute(Mongo.java:772)
      8. com.mongodb.Mongo$2.execute(Mongo.java:759)
      9. com.mongodb.DBCollection.findOne(DBCollection.java:777)
      10. com.mongodb.DBCollection.findOne(DBCollection.java:747)
      11. com.mongodb.DBCollection.findOne(DBCollection.java:694)
      11 frames
    3. Spring Data MongoDB - Core
      MongoTemplate.findOne
      1. org.springframework.data.mongodb.core.MongoTemplate$FindOneCallback.doInCollection(MongoTemplate.java:2143)
      2. org.springframework.data.mongodb.core.MongoTemplate$FindOneCallback.doInCollection(MongoTemplate.java:2127)
      3. org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:1901)
      4. org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:1712)
      5. org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:586)
      6. org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:581)
      6 frames
    4. com.mydhara.core
      App.main
      1. com.mydhara.core.App.main(App.java:60)
      1 frame