Error while connecting from openHAB-cloud to mongodb: MongoError: Authentication failed

Error while connecting from openHAB-cloud to mongodb: MongoError: Authentication failed

我的 mongodb 身份验证是错误的,但出现错误 我的 mongodb.conf 文件没有认证

# Turn on/off security.  Off is currently the default


#noauth = true
#auth = true

我的 mongodb 用户配置文件

 "mongodb": {
    "hosts": ["127.0.0.1"],
    "db": "openhab",
    "user": "",
    "password": ""
}

空字符串仍被解析为一个值,因此如果您无需身份验证即可登录,您需要省略用户和密码字段。所以正确的解决方案是:

"mongodb": {
    "hosts": ["127.0.0.1"],
    "db": "openhab"
}