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 | 5 months ago
  1. 0

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

    Stack Overflow | 5 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
  2. 0

    GitHub comment 17#172791923

    GitHub | 11 months ago | KiranNaikwade
    java.lang.RuntimeException: de.caluga.morphium.driver.MorphiumDriverException: internal error
  3. 0

    Grails 3.1.6 with MongoDB 5.0.5-withDatabase with authentication does not work

    GitHub | 2 months ago | brittma
    com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'not authorized for query on itemtest.item' on server testdb3:27017
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Grails 3.1.6 with MongoDB 5.0.5-withDatabase with authentication does not work

    GitHub | 2 months ago | brittma
    com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'not authorized for query on itemtest.item' on server testdb3:27017
  6. 0

    An object is annotated with {{@Document}} and {{@TextIndexed}} on several fields. The text index is created on the collection the right way. I assume it's done when the object is accessed the first time. However if the collection (or the database) is dropped, while the context is in place, the object is recreated but without the index. Consider the following code: {code:java} mongoTemplate.save(new ObjectSource()); mongoTemplate.find(new Query(new TextCriteria().matching("bla")), ObjectSource.class); mongoTemplate.dropCollection(ObjectSource.class); mongoTemplate.save(new ObjectSource()); mongoTemplate.find(new Query(new TextCriteria().matching("bla")), ObjectSource.class); {code} The first find works fine, the second find throws the exception below. This is easily reproducible and behaves the same whether the collection exists in the database prior to the run or not. {noformat} org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=tenant1.objectSource limit=0 skip=0 Tree: TEXT : query=bla, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query' on server 127.0.0.1:27017; nested exception is com.mongodb.MongoQueryException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=tenant1.objectSource limit=0 skip=0 Tree: TEXT : query=bla, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query' on server 127.0.0.1:27017 at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:101) at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2069) at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1912) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1723) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1706) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:602) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:593) at com.cisco.lockhart.model.springmongo.filter.SpringIssueTester.testSpringReproduceIssue(SpringIssueTester.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:170) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212) at org.testng.internal.Invoker.invokeMethod(Invoker.java:707) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:348) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305) at org.testng.SuiteRunner.run(SuiteRunner.java:254) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) at org.testng.TestNG.run(TestNG.java:1057) at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:115) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.stop(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:115) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.mongodb.MongoQueryException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=tenant1.objectSource limit=0 skip=0 Tree: TEXT : query=bla, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query' on server 127.0.0.1:27017 at com.mongodb.connection.ProtocolHelper.getQueryFailureException(ProtocolHelper.java:102) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:303) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:54) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:260) at com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:183) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:397) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:394) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:196) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:169) at com.mongodb.operation.FindOperation.execute(FindOperation.java:394) at com.mongodb.operation.FindOperation.execute(FindOperation.java:57) at com.mongodb.Mongo.execute(Mongo.java:760) at com.mongodb.Mongo$2.execute(Mongo.java:747) at com.mongodb.DBCursor.initializeCursor(DBCursor.java:817) at com.mongodb.DBCursor.hasNext(DBCursor.java:151) at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1898) ... 56 more {noformat}

    Spring JIRA | 10 months ago | Doron Levari
    com.mongodb.MongoQueryException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=tenant1.objectSource limit=0 skip=0 Tree: TEXT : query=bla, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query' on server 127.0.0.1:27017

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    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