sql >> Databasteknik >  >> NoSQL >> MongoDB

Frågan misslyckades med felkod 13 och felmeddelandet 'inte auktoriserad på [db] för att utföra kommandot { find:

Prova detta för din Spring xml-konfiguration

<beans xmlns="https://www.springframework.org/schema/beans"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:mongo="https://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="https://www.springframework.org/schema/data/mongo https://www.springframework.org/schema/data/mongo/spring-mongo.xsd
    https://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">

    <mongo:mongo-client credentials="UserAdminNew:example@sqldat.com" />

    <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
        <constructor-arg ref="mongo" />
        <constructor-arg name="databaseName" value="NEWTest" />
    </bean>
</beans> 



  1. Kan inte ansluta med MongoDB-superanvändaren till de andra databaserna från terminalen

  2. Mongodb, grupp efter datediff och få timme

  3. Hur man kontrollerar den aktuella konfigurationen av MongoDB

  4. MongoDB Collection runCommand från PHP