Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password

错误如下:

Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password=, mechanismProperties={}}; nested exception is com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password=, mechanismProperties={}}"}

 

原因和解决方法:

因为在properties中配置了两句:

spring.data.mongodb.username=
spring.data.mongodb.password=

导致需要用户名和密码,username就是'',password就是hidden MongoDB如果没有特殊配置不要写下面两条语句

 

解决方法:去掉这两句就行了

你可能感兴趣的:(MongoDB)