首页 > 数据库技术 > 详细

springboot集成mongoDB需要认证

时间:2019-11-25 10:11:27      阅读:1157      评论:0      收藏:0      [点我收藏+]

报错:

Mon Nov 25 01:09:48 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
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"}
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"}
 
报错的配置:
spring:
  application:
    name: spring-boot-mongodb
  data:
    mongodb:
      username: test
      password: 123456
      uri: mongodb://192.168.180.113:27017/test

解决:

spring:
  application:
    name: spring-boot-mongodb
  data:
    mongodb:
      uri: mongodb://test:123456@192.168.180.113:27017/test

 

springboot集成mongoDB需要认证

原文:https://www.cnblogs.com/dalianpai/p/11925480.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!