MongoError - 身份验证错误(带@的密码)
Posted
技术标签:
??????MongoError - ??????(?@???)??????:MongoError - Authentication error (password with @) ??????:2019-12-16 07:04:27 ??????:???? NodeJS ????????,??????? MongoDB ??:
const collection = 'mynewcollection';
const password = 'passwordwithan@';
const mongoUrl = `mongodb://admin:$encodeURIComponent(password)@mymongobase.net/$collection`;
// Connect using the connection string
MongoClient.connect(mongoUrl, useNewUrlParser: true, function(err, db)
console.log(err.toString())
);
?????????????????????“@”???????????????... ???????????,???????
API ????????????????
?????
??????:
MongoDB password with "@" in it????? ??????,@ ????????,???????,Mongo ???????????“admin”......????????????????,???????????????????????????(?????????????????)? ?????1?:??,????????? ?????:
const mongoUrl = `mongodb://admin:$encodeURIComponent(password)@mymongobase.net/$collection`;
Mongo ????? ?????????/???????
?????????mongo url?:
const mongoUrl = `mongodb://admin:$encodeURIComponent(password)@mymongobase.net`;
?????????mongo????????????
????:
以上是关于MongoError - 身份验证错误(带@的密码)的主要内容,如果未能解决你的问题,请参考以下文章
MongoDB 通过 Mlab - MongoError:身份验证失败
MongoError:身份验证失败。 NestJs MongoDb 图集
(节点:32032)UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝 id:1):MongoError:身份验证失败