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:password@]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, saving you time.

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!

Generated MongoDB connection string via Studio 3T

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

Copy 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!

Connecting to Studio 3T by uploading a connection URI file

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.

Complement this guide by reading up on the different ways to view your data, or how to edit your data in-place.