Docs Menu

Docs HomeMongoDB Atlas

Connect via mongosh

On this page

  • Prerequisites
  • Connect to Your Database Deployment
  • Troubleshooting

The Connect dialog for a database deployment provides the details to connect to a database deployment via the MongoDB shell, mongosh.

Clients must support TLS to connect to an Atlas database deployment.

Clients must support the SNI TLS extension to connect to an Atlas M0 free cluster or an M2/M5 shared cluster. MongoDB 4.0 and later shell supports the SNI TLS extension.

To access a database deployment, you must connect from an IP address on the Atlas project's IP access list. If you need to add an IP address to the IP access list, you can do so in the Connect dialog. You can also add the IP address from the Network Access tab.

To access a database deployment, you must create a database user with access to the desired databases on your Atlas database deployment. Database users are separate from Atlas users. Database users have access to MongoDB databases, while Atlas users have access to the Atlas application itself.

You can create a database user to access your Atlas database deployment in the Connect dialog. You can also add the database user from the Database Deployment view.

  1. Click Database in the top-left corner of Atlas.

  2. In the Database Deployments view, click Connect for the database deployment to which you want to connect.


Choose Connection Type from the set of available buttons.


Options Display if Feature Enabled

Atlas displays the connection type options after you enable Private IP for Peering, Private Endpoint, or both. If you haven't enabled either feature, no buttons display and Connection Type defaults to Standard.



Skip this step if Atlas indicates in the Setup connection security step that you have at least one database user configured in your project. To manage existing database users, see Configure Database Users.

To access the database deployment, you need a MongoDB user with access to the desired database or databases on the database deployment in your project. If your project has no MongoDB users, Atlas prompts you to create a new user with the Atlas Admin role.

  1. Enter the new user's Username.

  2. Enter a Password for this new user or click Autogenerate Secure Password.

  3. Click Create Database User to save the user.

Use this user to connect to your database deployment in the following step.

Once you have added an IP address to your IP access list and added a database user, click Choose Your Connection Method.


Select Shell.

The next screen offers you options to proceed based on whether or not you already have mongosh installed on your system.

If you are experiencing issues connecting to your database deployment, see Troubleshoot Connection Issues.

←  Connect via CompassConnect via BI Connector for Atlas →