Navigation

Connect via mongo Shell

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

  • For MongoDB 3.2 clusters, use the 3.2.6 or later version of the mongo shell with TLS/SSL support.
  • For MongoDB 3.4 clusters, use the 3.4.0 or later version of the mongo shell with TLS/SSL support.

Prerequisites

TLS/SSL

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 cluster.

Whitelist
To access a cluster, you must connect from an IP address on the Atlas group’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

1

Open the Connect dialog.

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

2

From the Connect dialog, review the IP Whitelist.

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

Atlas displays any entries already on the group whitelist in the Connect modal under Check the IP Whitelist. If you do not see the IP address of your client 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.

    Warning

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

3

Select Connect with the Mongo Shell.

The Connect dialog displays operating system-specific instructions for downloading the appropriate version of the mongo shell for the Atlas cluster, as well as the full command for connecting to the Atlas cluster with the mongo shell.

Follow the instructions in the Connect dialog to download and install the shell before continuing.

Once you confirm you have the correct version of the mongo shell, copy and paste the connection string into a terminal or command line interface. Do not execute the command yet.

The connection string uses a MongoDB user set up for the group as the user to authenticate as. Update the <PASSWORD> placeholder with the password for this user. Once you have updated the PASSWORD, you can execute the command to connect to the Atlas cluster.

To connect with a different MongoDB user, update the --username and --password parameters with the username and password of a different MongoDB user.