Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
search

Studio 3T® Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

Connection Manager

Posted on: 28/07/2020 (last updated: 15/10/2021) by Kathryn Vargas
tl;dr
Shortcuts

Whether you are using MongoDB Atlas, MongoDB Community Server, or MongoDB Enterprise Server, the Connection Manager in Studio 3T makes it easy to connect to a standalone connection, replica set, sharded cluster, or DNS seedlist. Download it here.

Connect – Ctrl + N (⌘ + N)
Open Collection Tab – F10
Exit Studio 3T – Alt + X (⌘ + Q)

Four ways to connect to MongoDB

Studio 3T provides four ways to connect to a MongoDB server. You can:

  • Paste a MongoDB connection string or URI
  • Import connection details automatically from other clients (e.g. Robo 3T)
  • Import a URI file
  • Enter connection details manually

Paste a URI or connection string (e.g. from MongoDB Atlas)

Hosters like MongoDB Atlas, Compose, mLab, ObjectRocket, and ScaleGrid provide the MongoDB URI or connection string from their respective interfaces.

Studio 3T supports the two connection string formats: Standard and DNS Seedlist.

The standard connection string format looks like:

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

While the DNS Seedlist connection format uses a different +srv prefix:

mongodb+srv://server.example.com/?connectTimeoutMS=300000&authSource=aDifferentAuthDB

Once you have your connection string ready, click on the Connect button from the global toolbar and choose New Connection.

Creating a new connection via the toolbar

Or click on Create a new connection from the Quickstart tab.

Create a new connection directly from the Quickstart tab

This will open the New Connection window. By default, you will land on the Server tab.

Name the connection then click on From URI.

Name the connection and click the From URI button

Paste the connection string and click OK.

Paste the MongoDB connection string

Regardless of the connection type chosen, Studio 3T will automatically extract the information and pre-populate the fields in the Server, Authentication, SSL, SSH Tunnel, and Advanced tabs. It will also save the connection for later use.

You can choose to use your own cryptographic key store to encrypt connection passwords in Studio 3T. Learn more about it here.

Import connections from Robo 3T (Robomongo), NoSQLBooster, and other clients

Studio 3T automatically detects and imports connection details – including SSH credentials – already saved in other clients like Robo 3T and NoSQLBooster.

Simply click on Import in the toolbar and Studio 3T will list the auto-detected connections in the Import Connections window.

Import connection details from other clients

Import a URI file

To import a URI file, click on the Connect button in the global toolbar or Open Connection Manager under the Quickstart tab. This will open the Connection Manager.

Click on Import. Then, choose Open Connection URI File.

Import from a URI file

Choose your .uri file and click Import.

Choose the uri file then click on Import

CAUTION: The standard URI format supports credential, server and database information, but it doesn’t support extra information like SSH and SSL details.

While pasting URIs and importing URI files might work seamlessly in Studio 3T, other tools and cloud providers only support the standard URI format. A Studio 3T-generated connection string, for example, might have all the information (e.g. SSH details, passwords), but other tools might strip it down to the standard format, which means you might have to enter these details manually.

Enter connection details manually

In the following chapters, we’ll walk you through how to connect manually to the four supported connection types: standalone connection, replica set, sharded cluster, and DNS seedlist.

Test MongoDB connection

You can always test a connection by clicking on Test Connection.

Test MongoDB connection

Note that in most cases (e.g. connecting to MongoDB Atlas), Detecting MongoDB server feature compatibility version will be N/A, but you will still be able to save and connect successfully.

Connect to a standalone connection (e.g. MongoDB localhost)

Let’s try to connect to localhost (which runs on default port 27017) as an example of a standalone connection.

Open the Connection Manager, name the connection, and choose Standalone from the dropdown.

Fill out the Server and Port fields and click Save.

Connect to a standalone connection, like localhost

This saves the connection for later use in the Connection Manager. Finally, click on Connect.

If you require additional configuration (e.g. SSH, SSL), skip ahead to the Configure your MongoDB connection chapter.

Connect to a replica set

Choose Replica set from the dropdown menu. This will display the Members section.

Connect to a replica set member

Click on Add to define the additional replica set members, then click OK. Add or remove members as needed.

Next, type the Replica Set Name and choose the Read Preference mode.

Name the replica set

Studio 3T has a handy Discover button which discovers replica sets automatically, as long as you’ve defined at least one replica set member.

Per MongoDB’s documentation:

Read preference modeDescription
primary
Default mode. All operations read from the current replica set primary.
Multi-document transactions that contain read operations must use read preference primary. All operations in a given transaction must route to the same member.
primaryPreferred
In most situations, operations read from the primary but if it is unavailable, operations read from secondary members.
secondaryAll operations read from the secondary members of the replica set.
secondaryPreferredIn most situations, operations read from secondary members but if no secondary members are available, operations read from the primary.
nearestOperations read from member of the replica set with the least network latency, irrespective of the member’s type.

Configure any additional authentication, SSL, SSH, etc. settings, click Save, then click on Connect.

Connect to a sharded cluster

Select Sharded cluster from the dropdown menu. This will open the Hosts section.

Connect to a sharded cluster

In case you were wondering what the difference is between a replica set and a sharded cluster, here’s a handy StackExchange answer.

In case you were wondering what the difference is between a replica set and a sharded cluster, here’s a handy StackExchange answer.

Click on Add to add new hosts or Remove to delete them as needed. Then, choose the Read Preference.

Set up any needed configuration under the Authentication, SSL, SSH, Proxy, MongoDB Tools, and Advanced tabs, click Save, then Connect.

Connect to a DNS seedlist

The DNS connection seedlist was introduced in MongoDB 3.6 and is now the default connection string format from hosting providers like MongoDB Atlas.

Choose DNS seedlist from the dropdown and fill out the Server, Replica Set, and Read Preference fields.

Choose DNS seedlist from the dropdown

If you’re pasting your URI directly from a hoster, e.g. MongoDB Atlas, Studio 3T will automatically pre-populate the Server, Replica Set Name, and Read Preference fields.

Finish setting up your connection under the Authentication, SSL, SSH, Proxy, MongoDB Tools, and Advanced tabs as needed.

Click Save. Then, click Connect.

Configure your MongoDB connection

The Connection Manager has seven tabs – Server, Authentication, SSL, SSH, Proxy, MongoDB Tools, and Advanced tabs – where you can configure the rest of your connection setup.

Server settings

Under the Server tab, you can also enable other settings like read-only lock, color-coding, and grouping connections into folders.

Group MongoDB connections into folders

You can group connections into folders in Connection Manager  to help declutter your view.

To create a group, click on New Group in the Connection Manager, name the group, and click OK.

Create a connection group

This saves the connection group, which you could select from the Connection group dropdown in the Server tab.

Choose the connection group from the dropdown menu

Color-code connections

Click on the palette icon and choose a color for your connection.

Color-code connections with Studio 3T's Connection Manager

This will color-code your servers, databases, and collections in the Connection Tree, as well as connection tabs – a handy way to avoid production and test database mixups.

Color-code connections, collections, servers, and tabs

Enable/disable read-only mode

Check Read-Only Lock to enable or disable read-only mode for the results shown in the connection you’re about to set up.

Enable or disable read-only mode

Authentication settings

Studio 3T supports these authentication methods:

  • None
  • Basic (SCRAM-SHA-256)
  • Legacy (SCRAM-SHA-1)
  • X.509
  • Kerberos (GSSAPI) – Studio 3T Ultimate only
  • LDAP (Plain) – Studio 3T Ultimate only

Studio 3T no longer supports MongoDB-CR authentication, which MongoDB stopped supporting in its latest version, MongoDB 4.0. Read our blog post to learn more.

Basic and Legacy authentication cover most cases.

Additional options in Connection Manager
  • Authentication Mode – Choose your authentication mode.
  • User Name – Enter your user name.
  • Password – Enter your password. Note that Studio 3T encrypts passwords by default. Alternatively, you can choose to use your own cryptographic key store. Leave the field blank if you prefer not to store your password, you will then be prompted to enter it later when you try to connect to the server.
  • Authentication DB – Enter the database where the user is defined.
  • Always show the authentication database of the user account – Checking this box will always show the authentication database in the Connection Tree.
  • Always show all databases defined in roles of the user – Checking this box will additionally always show any other databases that your user privileges allow, e.g. databases that contain collections your user privileges grant you access to.
  • Manually list additional visible databases by their names – In most cases, Studio 3T will automatically list the databases that should be visible to non-admin users. In some cases when this information isn’t available, you can check the box and manually specify them here.

SSL settings

The SSL tab can be quite overwhelming, so let’s break it down.

MUST – If you want to use SSL to connect to MongoDB, it’s imperative to check the box Use SSL protocol to connect. You then have to fill out the rest of the tab depending on your authentication method and settings.

Check the Use SSL protocol to connect

The following section needs to be filled out regardless of your chosen authentication method. The options, from most secure to least secure, are:

Set up SSL certificate on MongoDB
  • Use own Root CA file – Likely the option for users in enterprise settings. Here, simply locate the Root CA file provided by your team/company.
  • Accept server SSL certificates trusted by the operating system – Reuses the list of OS-trusted server SSL certificates.
  • Accept any server SSL certificates – This is the least secure option. Server verification is, of course, highly encouraged.

The next section on setting up a client certificate needs to be filled out especially when using the X.509 authentication method. If you’ve chosen X.509 in the Authentication tab, this will trigger an additional field called X.509 User. 

Using X.509? Set up the client certificate here
  • Client certificate – Locate the certificate on your computer.
  • Passphrase – Enter your passphrase.
  • X.509 User – Fill this out to override the default value – the subject – read by the database from the client certificate.
  • My client certificate is not protected by a passphrase – Check if your client certificate is not encrypted by a passphrase.

Check the remaining checkboxes as needed.

Configure other SSL settings
  • Allow invalid hostnames – Disables the validation of hostnames in TSL/SSL certificates.
  • Use Server Name Indication (Advanced) – Some servers may require the client to specify the server name it’s trying to connect to. If so, fill out this field so that the server can present one of the many SSL certificates.

SSH Tunnel settings

Check the Use SSH tunnel to connect box, if applicable, and fill out the fields

Use SSH to connect to your MongoDB server
  • SSH Address – Enter the SSH address.
  • Port – Enter the Port number.
  • SSH User Name – Enter your SSH user name.
  • SSH Auth Mode – Choose between Password or Private Key.
  • SSH Password –  Enter your password. Note that Studio 3T encrypts passwords by default. Alternatively, you can choose to use your own cryptographic key store. If you don’t want to store your password, leave the field blank and you’ll be prompted to enter it later.
  • SSH Private Key and Passphrase – If you’ve chosen Private Key as the Auth Mode, enter the private key and passphrase here.

Proxy settings

Studio 3T offers HTTP and SOCKS proxy connection support.

Connect using HTTP and SOCKS proxy settings
  • Application default proxy – Choosing this option means the Proxy settings defined under Studio 3T > Preferences > Network will be used.
  • Custom proxy (HTTP and SOCKS) – These HTTP and SOCKS custom proxy settings are available when connecting to MongoDB databases, connecting to SQL databases for import, and for application-run HTTPS requests (e.g. Telemetry).
  • Direct/No proxy

Please note that this proxy configuration will not enable Studio 3T’s IntelliShell to connect through the given proxy, since the underlying mongo shell does not support proxy connections.

MongoDB Tools settings

The Connection Manager will use global settings by default, which means that the connection will use the mongo executables defined in Preferences (Studio 3T > Preferences > MongoDB Tools). In most cases, it will be the mongo executables bundled with Studio 3T.

However, it also gives you the flexibility to configure the mongo executable version to use for each individual connection.

Uncheck the Use global settings checkbox and choose the mongo executable version (in this case, 3.4.x):

Specify the mongo tool version for each connection

Under the IntelliShell, mongorestore, and mongodump tabs, you can choose to use the mongo executables bundled with Studio 3T for that version, those found on your PATH environment variable, or your own individual files.

Related reading: How to Configure mongodump, mongorestore & mongo shell Executable Files

Advanced settings

Under the Advanced tab, you can configure other settings related to connection timeouts, idle times, and retry writes.

Set connection timeout settings and more
  • Max connection idle time (in ms) – Sets the maximum idle time in milliseconds for a connection. In some cases, the connection could be dropped by a firewall or a load balance. Default value of “0” means unlimited idle time.
  • Server selection timeout (in ms) – Defines how long Studio 3T will wait for server selection to succeed before throwing an exception.Default value is 30000. A value of 0 means it will time out immediately if no server is available. A negative value means it will wait indefinitely.
  • Socket timeout (in ms) – Sets the socket timeout in milliseconds. It is used for I/O socket read and write operations. Default value is “0” and means no timeout.
  • Connect timeout (in ms) – Sets the connection timeout in milliseconds, used solely when establishing a new connection. A value of “0” means no timeout. Default value is 10000.
  • Retry writes – Choose to enable retryable writes, which allow MongoDB drivers to automatically retry certain write operations a single time if they encounter network errors, or if they cannot find a healthy primary in the replica sets or sharded cluster.

How to export connection details

Once you’ve entered all connection details under the Server, Authentication, SSL, SSH, Proxy, MongoDB Tools, and Advanced tabs, you can export the connection string in two ways: by exporting to a MongoDB URI or to a URI file.

Export to a MongoDB URI

Choose the connection from the Connection Manager and click on Export in the toolbar.

Export connection to a connection string or URI

Or edit the connection and click on To URI on the Server tab.

Click on To URI on the Server tab

Edit the settings as needed (e.g. include passwords, SSH configuration, convert DNS seedlist to standard format).

Export connection settings to a URI or file

Choose Export to Clipboard to paste and share it with your team, or choose Export to File to export the connection to a .uri file.

Export to a URI file

From the Connection Manager, you can also choose the connection, click on To URI from the toolbar, and follow the steps mentioned above to export to a URI file.

Export your connection to a URI file

How to (help) prevent a connection timeout

After a relatively short period of inactivity, you might try to run a query from within Studio 3T, but are presented with a server error message box. If you try again, the query will work properly again.

The reason is that in some configurations, the connection can get dropped by a firewall or a load balancer. This issue is common with MongoDBs hosted on Azure.

The folks over at mLab have some interesting details on this matter: http://docs.mlab.com/connecting/#known-issues.

The solution is to manually set the max connection idle time to 60s (60000ms) under the Advanced tab:

A little tip on how to prevent a connection timeout

After that, your connection should no longer drop ?


Already connected to your database? Get cracking with query building:

  • Visual Query Builder – Drag and drop fields to build MongoDB queries, perfect for those still learning the MongoDB query syntax
  • IntelliShell – Prefer a command line interface? Try our smart mongo shell with autocompletion
  • Aggregation Editor – Build aggregation queries stage by stage and check inputs and outputs at each step
  • SQL Query – Put your SQL skills to use and write SQL expressions to query MongoDB

How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Kathryn Vargas

When she's not writing about working with MongoDB, Kathryn spends her free time exploring Berlin's food scene, playing the drums, learning languages (current mission: German), and hiking.

Article navigation

Related articles

  • How to Connect to the License Manager Through a Proxy Server
  • Query Manager and Bookmarks
  • What’s New in Studio 3T 2020.4 | Introducing License Manager, IBM DB2 Migration Support, Export Wizard Improvements
  • What’s New in Studio 3T 2020.9 | Query Manager, Elapsed Time Indicator & More
  • The License Manager and Proxy Servers

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in our Privacy Policy.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Reddit

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

HubSpot

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected