Connect with mongosh
Open a mongosh session against a TeselaDB node with TLS and a user.
Open a mongosh session against TeselaDB to query and administer the cluster by hand. mongosh is the MongoDB shell
and works unchanged.
Requirements
mongoshinstalled; it comes from the MongoDB website.- The address of a node, a user with its password and the
pki/ca.pemfile of the cluster.
Open the session
Shell
mongosh "mongodb://root:<password>@127.0.0.1:27017/?tls=true&tlsCAFile=./ca.pem"To keep the password out of the history, take it out of the string and add --password; mongosh will ask for it.
Check
JavaScript
db.runCommand({ connectionStatus: 1 });The response carries in authInfo.authenticatedUsers the user you logged in as, along with the database it
authenticates against.
Common problems
- The connection closes before authenticating because
tls=trueis missing from the string. mongoshdoes not trust the node certificate becausetlsCAFiledoes not point to thepki/ca.pemof this cluster.