I'm trying to connect to a local MongoDB using only a URI string over TLS. I can connect just fine using flags, but for my project's purposes I'd like to have a URI string too.
For example, the following works:
mongo mongodb://127.0.0.1:27017/dbName --tls --tlsCAFile=/path/to/ca.pem --tlsCertificateKeyFile=/path/to/key.pem
But I'd like for something like this to work:
mongo 'mongodb://127.0.0.1:27017/dbName?tls=true&tlsCAFile=/path/to/ca.pem&tlsCertificateKeyFile=/path/to/key.pem'
How do I write this URI string to get it to work for my intended purposes?
Any help is appreciated, thanks.
I've figured these two variants to work the same way (this includes username and password in addition to the client certificate):
or
note: passwords not containing '@' make things easier ... and the case of True vs. true does matter.