如何使用连接字符串连接到 Amazon DocumentDB?

How to connect to Amazon DocumentDB using a connection string?

我正在尝试按照 here 所述通过 SSH 端口转发连接到 Amazon DocumentDB 集群。我可以使用这个命令连接...

mongosh --host localhost:27017 --ssl --sslAllowInvalidHostnames --sslCAFile rds-combined-ca-bundle.pem --username REDACTED --password REDACTED

...但不是这个命令...

mongosh mongodb://REDACTED:REDACTED@localhost:27017/?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem

失败并显示错误消息“无法获取本地颁发者证书”。至少有一个问题是我无法找到任何关于如何将 --sslAllowInvalidHostnames 选项转换为连接字符串格式的文档。我找到了 ,但是添加 &sslVerifyCertificate=false 并没有改变任何东西,所以我在这里可能做错了什么。

我想通了(有点)。我从来没有通过 mongosh 获得连接字符串,但是当使用它在代码中连接时,这是我的最终目标,there are language-specific steps you have to take to install the CA cert。然后您可以使用这样的连接字符串连接您的应用程序。

mongodb://REDACTED:REDACTED@localhost:27017?tls=true&tlsInsecure=true