[英]MongoDB production AUTH FAILED
I'm trying to connect my server to my MongoDB database in production, 我正在尝试将服务器连接到生产环境中的MongoDB数据库,
But When I try to do that : 但是当我尝试这样做时:
mongoose.connect("mongodb://user:randompassword@ds011452.mlab.com:11452/dbname?authSource=dbWithUserCredentials");
I get a 我得到一个
connection error: { [MongoError: auth failed] name: 'MongoError', ok: 0, errmsg: 'auth failed', code: 18 }
note : my dbname is the same as the username... 注意:我的数据库名与用户名相同。
Any IDeas ? 有任何想法吗 ?
I've find my answer : 我找到了答案:
I've upgraded mongoDB
to the 3.0 version
, 我已经将mongoDB
升级到3.0 version
,
and after that I've upgraded mongoose
to the > 4.3.0 version 然后我将mongoose
升级到了> 4.3.0版本
http://mongoosejs.com/docs/compatibility.html http://mongoosejs.com/docs/compatibility.html
and It works ! 而且有效!
edit : 编辑:
after update mongoDB to 3.0 (I used brew
) 将mongoDB更新为3.0之后(我使用brew
)
package.json
->
"dependencies": {
"mongoose": "~4.3.0",
...
then npm install
然后npm install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.