Connect to a MongoDB Instance

This topic explains how to connect to your MongoDB instance using mongosh.

1. In the DCD, go to Menu > Databases > MongoDB.

A list of all MongoDB clusters is displayed.

2. Select a cluster from the list by clicking on its name. Alternatively, click Details in the OPTIONS column.

3. On the MongoDB Cluster overview page, navigate to the Cluster details tab and copy the cluster's Connection URI.

View the details of a MongoDB cluster

4. Open your terminal and run the following command:

mongosh -u <yourUsername> -p <yourPassword> "<your-Connection-URI>"

Replace the following:

  • <yourUsername> with your database username.

  • <yourPassword> with your password.

  • <your-Connection-URI> with the Connection URI you copied from the DCD.

Here is an example of a MongoDB shell connection:

Connect to a MongoDB via Shell Connection

Last updated

Was this helpful?