springboot集成mongoDB需要认证
<p>报错:</p><div id="created">Mon Nov 25 01:09:48 CST 2019</div>
<div>There was an unexpected error (type=Internal Server Error, status=500).</div>
<div>Command failed with error 13 (Unauthorized): 'command update requires authentication' on server 192.168.180.113:27017. The full response is {"ok": 0.0, "errmsg": "command update requires authentication", "code": 13, "codeName": "Unauthorized"}; nested exception is com.mongodb.MongoCommandException: Command failed with error 13 (Unauthorized): 'command update requires authentication' on server 192.168.180.113:27017. The full response is {"ok": 0.0, "errmsg": "command update requires authentication", "code": 13, "codeName": "Unauthorized"}</div>
<div>org.springframework.data.mongodb.UncategorizedMongoDbException: Command failed with error 13 (Unauthorized): 'command update requires authentication' on server 192.168.180.113:27017. The full response is {"ok": 0.0, "errmsg": "command update requires authentication", "code": 13, "codeName": "Unauthorized"}; nested exception is com.mongodb.MongoCommandException: Command failed with error 13 (Unauthorized): 'command update requires authentication' on server 192.168.180.113:27017. The full response is {"ok": 0.0, "errmsg": "command update requires authentication", "code": 13, "codeName": "Unauthorized"}</div>
<div> </div>
<div>报错的配置:</div>
<div>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">spring:
application:
name: spring</span>-boot-<span style="color: rgba(0, 0, 0, 1)">mongodb
data:
mongodb:
username: test
password: </span>123456<span style="color: rgba(0, 0, 0, 1)">
uri: mongodb:</span>//192.168.180.113:27017/test</pre>
</div>
<p>解决:</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">spring:
application:
name: spring</span>-boot-<span style="color: rgba(0, 0, 0, 1)">mongodb
data:
mongodb:
uri: mongodb:</span>//test:123456@192.168.180.113:27017/test</pre>
</div>
<p> </p>
</div><br><br>
来源:https://www.cnblogs.com/dalianpai/p/11925480.html
頁:
[1]