Connect via Compass

The Connect dialog for a cluster provides the details to connect to a cluster via Compass.



Clients must have support for TLS/SSL to connect to an Atlas cluster.

Clients must have support for the SNI TLS extension to connect to an Atlas M0 Free Tier or M2/M5 shared starter cluster. The SNI TLS extension is supported by Compass version 1.5 and up.

To access a cluster, you must connect from an IP address on the Atlas project’s IP whitelist. If you need to add an IP address to the whitelist, you can do so in the Connect dialog. You can also add the IP address from the Security tab.

Connect to Your Cluster

Use the following procedure to connect Compass 1.8 or later versions to your Atlas cluster.


Open the Connect dialog.

Go to the Clusters view. Click the Connect button for the cluster to which you wish to connect.


From the Connect dialog, review the IP Whitelist.

Atlas only allows client connections to the cluster from entries in the project’s whitelist.

Atlas displays any entries already on the project whitelist in the Connect modal under Check the IP Whitelist. If you do not see the IP address of the machine from which you will run Compass on the list, you can:

  • Click Add Entry to add a single IP address or a CIDR-notated range of addresses.

    For Atlas clusters deployed on Amazon Web Services and using VPC Peering, you can add a Security Group associated with the peer VPC.

  • Click Add Current IP Address to add your current IP address.

  • Click Allow Access From Anywhere to allow access from any IP address.


    Using Allow Access From Anywhere results in all clusters in the Atlas project being publicly accessible. Consider the security risks of having public-facing MongoDB clusters before using this option.


Select Connect With MongoDB Compass.

  1. If you do not already have MongoDB Compass installed, the Connect dialog provides links to download and install the latest version of MongoDB Compass.

  2. Under Copy the URI Connection String, click either:

    • I am using Compass 1.12 or later
    • I am using Compass 1.11 or earlier

    and copy the MongoDB connection string.

  3. Open the Compass application. Compass automatically detects the URI connection string in the system clipboard and prompts you to allow it to auto-fill the connection details. Click Yes.

  4. To authenticate to the cluster, the URI connection string includes a MongoDB user set up for the project. Compass autofills the Username field with that user. Fill in the Password field with the password for the user.

    To connect with a different MongoDB user, update the Username and Password fields with the username and password of a different MongoDB user.

  5. You can optionally fill in the Favorite Name field with a name for the connection. When you use Compass in the future, previous connections appear in the left pane of the Compass Connect window under Favorites.

  6. Click Connect to connect Compass to your cluster.

For Compass 1.7 or earlier versions, you can manually create a new connection in Compass.

To set up a New Connection from Compass to your Atlas cluster, enter the following information in Compass and click Connect:

Field Name Description

The hostname of primary for a replica set or the hostname for the mongos for a sharded cluster.

For a replica set, you can locate the primary hostname in the Atlas UI by:

  1. Clicking Clusters,
  2. Clicking the cluster you want to connect to,
  3. Click on the replica set member marked as PRIMARY, and
  4. Copy the hostname of the replica set.

For a sharded cluster, from the Atlas UI click Connect for the cluster and click Connect Your Application. Extract the mongos hostname from the URI connection string.

Make note of the port number of the primary or mongos and use it to fill in the Port field in Compass.

Port The port of the primary for a replica set or the port for the mongos for a sharded cluster.
Authentication Select Username / Password.
Username MongoDB user. The Atlas connection details displays the MongoDB administration user set up for the cluster. You can connect with a different MongoDB user.
Password Password associated with the specified MongoDB user.
Authentication Database Specify "admin".
Replica Set Name The name of the Atlas cluster’s replica set. You can retrieve this by clicking the Connect button for the cluster and selecting Connect Your Application. Extract the replica set name from the URI connection string’s replicaSet value.
Read Preference Specify how Compass directs read operations. Options are Primary, Primary Preferred, Secondary, Secondary Preferred, and Nearest. See /core/read-preference.
SSL Select "Use System CA / Atlas Deployment"
SSH Tunnel Select "Off"
Favorite Name Enter a name for the connection if saving as a favorite.