Como resolver: "Caused by: com.mongodb.MongoCommandException: Command failed with error 13 (Unauthorized): 'command insert requires authentication' on server localhost:27017."

1 resposta
mongodbjavaspring-bootspring
R

Galera, eu tentei me conectar ao mongodb pelo com o spring. Ele até chega a conectar, pois há a mensagem:

Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=17, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=34788163}

No entanto, ao fazer um insert ele lança essa exceção para mim:

Caused by: com.mongodb.MongoCommandException: Command failed with error 13 (Unauthorized): 'command insert requires authentication' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "command insert requires authentication", "code": 13, "codeName": "Unauthorized"}

1 Resposta

E

A mensagem de erro está lhe dizendo qual é o problema, amigo.

Criado 1 de fevereiro de 2023
Ultima resposta 1 de fev. de 2023
Respostas 1
Participantes 2