# Connect to a MongoDB Instance

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

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](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-06a58436df1a3d0c53d7b344d199f221dcb6aaf2%2Fmongodb-properties-details.png?alt=media)

4\. Open your terminal and run the following command:

```bash
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.

{% hint style="success" %}
**Result:** You see the database is accepting connections.
{% endhint %}

Here is an example of a MongoDB shell connection:

![Connect to a MongoDB instance via Shell Connection](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-a4138d89f376d885f11fda28e978dd0ddfd39bdb%2Fmongodb-shell-connection.png?alt=media)
