连接到Cosmos DB模拟器

时间:2018-02-20 21:35:30

标签: node.js mongodb azure-cosmosdb

当我连接到这样的CosmosDB模拟器时:

mongodb://localhost:C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==@localhost:10255/admin?ssl=true

一切都按预期工作但我有

promise rejection:
(node:1840) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Password contains an illegal unescaped character
(node:1840) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

如何逃避这个@? 感谢

1 个答案:

答案 0 :(得分:1)

URL编码连接字符串的密码部分可能会解决此问题。请尝试此连接字符串:

mongodb://localhost:C2y6yDjf5%2FR%2Bob0N8A7Cgv30VRDJIWEHLM%2B4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw%2FJw%3D%3D@localhost:10255/admin?ssl=true

这可以解决问题吗?