# How to connect Digibee to MongoDB Atlas using VPN

To establish a connection between the Digibee Integration Platform and [MongoDB Atlas](https://www.mongodb.com/products/platform/atlas-database) using a Virtual Private Network (VPN), you need to contact [Digibee Customer Support](/documentation/troubleshooting/help-and-faq/support.md) and provide the following MongoDB Atlas details:

* The **cluster hostname**
* The **three hosts** used for load balancing by the main host

Once the VPN setup is complete, you can integrate MongoDB Atlas with Digibee using the [**MongoDB**](/documentation/connectors-and-triggers/connectors/structured-data/mongodb.md) connector.

## **Connecting Digibee to MongoDB Atlas**

{% hint style="info" %}
Steps 1 and 2 should be performed within the MongoDB Atlas platform. Please note that the interface may change over time. If you are unable to follow these steps, please contact our [Support team](/documentation/troubleshooting/help-and-faq/support.md) and we will update the documentation accordingly.
{% endhint %}

{% stepper %}
{% step %}

### **Obtain the cluster hostname**

The **cluster hostname** is automatically generated by MongoDB Atlas and is included in the connection string provided by MongoDB.

For example, in the connection string `mongodb+srv://cluster0.71llx.mongodb.net`, the **cluster hostname** is `cluster0.71llx.mongodb.net`.

Follow these steps to find the cluster hostname in Mongo Atlas:

1. In the **MongoDB Atlas** platform, go to the **Deployment** section and click **Database**.
2. On the next page, click **Connect**.
3. Under **Setup connection security**, select **Connect your application**.
4. The following page displays the full connection string. The **cluster hostname** is part of this string and follows a structure like `@cluster0.71llx.mongodb.net`.
5. Copy the hostname and save it for later use.

<figure><img src="/files/3p9knF20gACmjzmrbqCo" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Obtain the three hosts**

In addition to the **cluster hostname**, you need to retrieve the three hosts used for load balancing by the main host.

For example, if the main host is `cluster0.71llx.mongodb.net`, the load-balancing hosts are:

* `cluster0-shard-00-00.71llx.mongodb.net:27017`
* `cluster0-shard-00-01.71llx.mongodb.net:27017`
* `cluster0-shard-00-02.71llx.mongodb.net:27017`

Follow the steps below to find the three hosts:

1. In **MongoDB Atlas**, go to the **Deployment** section and click **Database**.
2. On the next page, click **View Monitoring**.
3. Open the **Metrics** tab.
4. Locate and copy the three hosts listed, then save them for later use.

<figure><img src="/files/zs0ydoQzzuckdynpQLUu" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Provide the collected information to the Support team**

After gathering all the required details, contact the [Digibee Customer Support](/documentation/troubleshooting/help-and-faq/support.md) and share the following:

* The **cluster hostname**
* The **three hosts** used for load balancing

Once this information is provided, the Digibee Support team will configure your realm to enable the pipeline to connect to MongoDB Atlas via a VPN connection.
{% endstep %}
{% endstepper %}

## **Using MongoDB Atlas on Digibee**

### **Authenticating Mongo Atlas**

To authenticate MongoDB Atlas on Digibee, you need to provide the **connection string**. By default, MongoDB Atlas includes the **username** and **password** in the connection string, but we recommend removing these credentials and storing them in an [**Account**](/documentation/developer-guide/development-cycle/build-overview/accounts.md) on Digibee for enhanced security.

#### **Saving credentials as an Account on Digibee**

Follow these steps to securely store your MongoDB Atlas credentials:

1. On the **Digibee Integration Platform** home page, click **Settings** in the upper-right corner.
2. Navigate to the **Accounts** page.
3. Create a new Account and configure the following details:
   * **Account name:** Choose a name, such as `account-mongoatlas`.
   * **Account type:** Select **Basic**.
   * **Username and Password:** Enter the credentials from the **Database Access** page in MongoDB Atlas.

By storing credentials this way, you establish a secure connection between the Digibee Integration Platform and MongoDB Atlas via VPN, enabling your pipelines to access the database safely.

### **Connecting the pipeline to the database**

After the VPN configuration is complete, you can connect your pipeline to the database using the [**MongoDB**](/documentation/connectors-and-triggers/connectors/structured-data/mongodb.md) connector.

#### **Required information:**

* The **Account** configured with the **Username** and **Password**.
* The **Connection String** (without credentials), for example: `mongodb+srv://cluster0.71llx.mongodb.net/<nomedobanco>`
* The **Database Name** and the **Collection Name**, which can be found in the **Collection** tab on **Data Services** on Mongo Atlas.

Here’s an example of the **MongoDB** connector configuration:

<figure><img src="/files/B4Ii2gIRD7JG6kHLSSOa" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digibee.com/documentation/troubleshooting/connectivity-guides/digibee-mongodb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
