MongoDB
 sql >> Database >  >> NoSQL >> MongoDB

Query non riuscita con codice di errore 13 e messaggio di errore "non autorizzato su [db] per eseguire il comando { trova:

Prova questo per la tua configurazione xml di primavera

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

    <mongo:mongo-client credentials="UserAdminNew:[email protected]" />

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