Try Studio 3T for Free
  1. Knowledge Base
  2. Studio 3T Documentation
  3. How MongoDB Connection Strings Work in Studio 3T

How MongoDB Connection Strings Work in Studio 3T

Check out our overview page for other info on Studio 3T connections.

If you’ve been shopping around for a MongoDB client, you may have come across the cumbersome task of manually entering connection details, or writing out a MongoDB connection string in the correct URI format.

Studio 3T makes connecting to a MongoDB database easy, which starts with how it treats connection strings or URIs.

The standard connection string format

mongodb://[username:[email protected]]host1[:port1][,host2[:port2],…[,hostN[:portN]]][/[database][?options]]

MongoDB does an excellent job of breaking down the components of the standard connection string.

In summary, the standard URI format supports credential, server and database information, but it doesn’t support extra information like SSH and SSL details.

Studio 3T has made it easier for users by preserving this extra information in all generated connection strings from the Connection Manager.

Read more about the Connection Manager here.

How to generate a MongoDB connection string

You can generate complete MongoDB connection strings within Studio 3T in two ways: exporting to a MongoDB URI or to a URI file.

Export to a MongoDB URI

  1. Enter all connection details as you normally would under the Server, Authentication, SSL, SSH Tunnel, and Replica Sets tabs.
  2. Once done, go back to the Server tab and click on “To URI…“.
  3. Your MongoDB connection URI should be generated – simply edit the settings as needed (e.g. include passwords, SSH configuration)
  4. Click “Copy to clipboard“. Your MongoDB connection string is ready to be pasted and shared!

Export to a URI file

  1. Ensure that you are or have recently connected to a database.
  2. On Studio 3T, click on “Connect” and choose a Connection.
  3. Click on “Export” – this will open the Export Connections window.
  4. Choose the Connection and edit the settings as needed (e.g. include passwords, SSH configuration).
  5. Click “Export“- this will trigger your .uri file export.
  6. Choose your file destination – and done!

How to connect with a MongoDB connection URI

Now that you have your connection URI, our MongoDB client also makes it easy to connect to a database through two ways: copy + paste and connection URI file import.

Copy + paste

  1. On Studio 3T, click on “Connect” and choose “New Connection
  2. Click on “From URI…” and paste your MongoDB connection URI

Import a URI file

  1. Paste your connection details to a text editor and save it as a .uri file.
  2. On Studio 3T, click on “Connect” and choose “Import“.
  3. Click on “Open Connection URI File“.
  4. Choose your .uri file, click “Import“… and you’re in!

While these two connection methods work seamlessly on Studio 3T, other MongoDB GUIs, clients, and cloud providers only support the standard URI format.

So even though your Studio 3T-generated MongoDB connection URI has all the information (e.g. SSH details, passwords), others might strip it down to the standard format and require you to enter the other details manually.

Already connected to your database? Read on to navigate Studio 3T like a pro:

Updated on December 5, 2019

Was this article helpful?

Related Articles

Leave a Comment