# MongoDB

This article outlines the integration with the MongoDB connector, enabling streamlined metadata management through features such as crawling, profiling, querying, data preview, and manual lineage building. It also ensures secure authentication via Credential Manager.

<figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FNtq3ujhkBU5ALmMYfD2E%2Fimage.png?alt=media&#x26;token=61b1644d-04f7-475d-9bf5-de029d4083b4" alt=""><figcaption></figcaption></figure>

## Overview

### **Connector** Details

<table data-header-hidden><thead><tr><th width="442"></th><th></th></tr></thead><tbody><tr><td>Connector Category</td><td>NoSQL</td></tr><tr><td>Connector Version</td><td>Release7.2.4</td></tr><tr><td>Releases Supported (Available from)</td><td>Release6.1</td></tr><tr><td><p>Connectivity</p><p>[How the connection is established with MongoDB]</p></td><td>JDBC driver</td></tr><tr><td>Verified MongoDB Version</td><td>3.12.11</td></tr></tbody></table>

{% hint style="info" %}
The MongoDB connector has been validated with the mentioned "Verified MongoDB Versions" and is expected to be compatible with other supported MongoDB versions. If there are any issues with validation or metadata crawling, please submit a support ticket for investigation and feedback.
{% endhint %}

### Connector Features

| Feature                                      | Availability |
| -------------------------------------------- | :----------: |
| Crawling                                     |       ✅      |
| Delta Crawling                               |       ❌      |
| Profiling                                    |       ✅      |
| Query Sheet                                  |       ✅      |
| Data Preview                                 |       ✅      |
| Auto Lineage                                 |       ❌      |
| Manual Lineage                               |       ✅      |
| Secure Authentication via Credential Manager |       ✅      |
| Data Quality                                 |       ✅      |
| DAM (Data Access Management)                 |       ❌      |
| Bridge                                       |       ✅      |

#### Metadata Mapping

The following objects are crawled from MongoDB and mapped to the corresponding UI assets.

<table><thead><tr><th width="184.666748046875">MongoDB Object</th><th width="182.6666259765625">MongoDB Attribute</th><th width="177">OvalEdge Attribute</th><th width="180">OvalEdge Category</th><th width="173.3333740234375">OvalEdge Type</th></tr></thead><tbody><tr><td>Table</td><td>Table Name</td><td>Table</td><td>Tables</td><td>Table</td></tr><tr><td>Table</td><td>Table Type</td><td>Table</td><td>Tables</td><td>Table</td></tr><tr><td>Table</td><td>Table Comments</td><td>Source Description</td><td>Descriptions</td><td>Source<br>Description</td></tr><tr><td>Columns</td><td>Column Name</td><td>Column</td><td>Table Columns</td><td>Columns</td></tr><tr><td>Columns</td><td>Data Type</td><td>Column Type</td><td>Table Columns</td><td>Columns</td></tr><tr><td>Columns</td><td>Description</td><td>Source<br>Description</td><td>Table Columns</td><td>Columns</td></tr><tr><td>Columns</td><td>Ordinal Position</td><td>Column Position</td><td>Table Columns</td><td>Columns</td></tr><tr><td>Columns</td><td>Length</td><td>Data Type Size</td><td>Table Columns</td><td>Columns</td></tr></tbody></table>

## Set up a Connection

### Prerequisites

The following are the prerequisites to establish a connection:

#### **Whitelisting Ports**

Ensure the inbound port “27017” is whitelisted for OvalEdge to connect to the MongoDB database.

{% hint style="warning" %}
The default port number for MongoDB is 27017. If a different port is used, ensure that the updated port number is specified during connection setup, the port is whitelisted, and communication between the system and MongoDB is properly established.
{% endhint %}

#### **Service Account User Permissions**

{% hint style="warning" %}
It is recommended to use a separate service account to establish the connection to the data source, configured with the following minimum set of permissions.
{% endhint %}

{% hint style="info" %}
👨‍💻 **Who can provide these permissions?** These permissions are typically granted by the MongoDB administrator, as users may not have the required access to assign them independently.
{% endhint %}

<table><thead><tr><th width="178.3333740234375">Objects</th><th width="266.666748046875">Sys Tables</th><th>Access Permissions</th></tr></thead><tbody><tr><td>Schema (Database)</td><td>listDatabases command</td><td>listDatabases privilege on the cluster</td></tr><tr><td>Tables (Collections)</td><td>listCollections command or system.namespaces collection</td><td>listCollections privilege on each database</td></tr><tr><td>Columns (Fields)</td><td>Derived by sampling documents using the find command</td><td>Find privilege on each collection</td></tr></tbody></table>

### Connection Configuration Steps

{% hint style="warning" %}
Users are required to have the Connector Creator role in order to configure a new connection.
{% endhint %}

1. Log into OvalEdge, go to **Administration > Connectors**, click **+ (New Connector)**, search for **MongoDB**, and complete the required parameters.

{% hint style="info" %}
Fields marked with an asterisk (\*) are mandatory for establishing a connection.
{% endhint %}

<table><thead><tr><th width="220.6666259765625">Field Name</th><th>Description</th></tr></thead><tbody><tr><td>Connector Type</td><td>By default, "MongoDB" is displayed as the selected connector type.</td></tr><tr><td>Authentication</td><td><p>OvalEdge supports the following two types of authentication for MongoDB:</p><ul><li>Service</li><li>Standalone</li></ul></td></tr></tbody></table>

{% tabs %}
{% tab title="Service" %}

<table><thead><tr><th width="190.6666259765625">Field Name</th><th>Description</th></tr></thead><tbody><tr><td>Credential Manager*</td><td><p>Select the desired credentials manager from the drop-down list. Relevant parameters will be displayed based on your selection.<br>Supported Credential Managers:</p><ul><li>OE Credential Manager</li><li>AWS Secrets Manager</li><li>HashiCorp Vault</li><li>Azure Key Vault</li></ul></td></tr><tr><td>Connector Name*</td><td>Enter a unique name for the MongoDB connection<br>(Example: "MongoDB_Prod").</td></tr><tr><td>Connector Environment</td><td>Select the environment (Example: PROD, STG) configured for the connector.</td></tr><tr><td>Connector description</td><td>Enter a brief description of the connector.</td></tr><tr><td>Server*</td><td>Enter the MongoDB database server name or IP address (Example: xxxx-xxxx.xxxx4ijtzasl.xx-south-1.rds.xxxxx.com or 1xx.xxx.1.x0).</td></tr><tr><td>Database*</td><td>Enter the database name to which the service account user has access within the MongoDB.</td></tr><tr><td>Driver*</td><td>By default, the MongoDB driver details are auto-populated.</td></tr><tr><td>Username*</td><td>Enter the service account username set up to access the MongoDB database (Example: "oesauser").</td></tr><tr><td>Password*</td><td>Enter the password associated with the service account user.</td></tr><tr><td>Connection String</td><td>Configure the connection string for the MongoDB database:<br>Automatic Mode: The system generates a connection string based on the provided credentials.<br><br>Manual Mode: Enter a valid connection string manually.<br><br>Replace placeholders with actual database details.<br>{sid} refers to Database Name.</td></tr><tr><td>Plugin Server</td><td>Enter the server’s name when running as a plugin server.</td></tr><tr><td>Plugin Port</td><td>Enter the port number on which the plugin is running.</td></tr></tbody></table>
{% endtab %}

{% tab title="Standalone" %}

<table><thead><tr><th width="190.6666259765625">Field Name </th><th>Description</th></tr></thead><tbody><tr><td>Credential Manager*</td><td>Select the desired credentials manager from the drop-down list. Relevant parameters will be displayed based on your selection.<br>Supported Credential Managers:<br>OE Credential Manager<br><br>AWS Secrets Manager<br><br>HashiCorp Vault<br><br>Azure Key Vault</td></tr><tr><td>Connector Name*</td><td>Enter a unique name for the MongoDB connection<br>(Example: "MongoDB_Prod").</td></tr><tr><td>Connector Environment</td><td>Select the environment (Example: PROD, STG) configured for the connector.</td></tr><tr><td>Connector description</td><td>Enter a brief description of the connector.</td></tr><tr><td>Server*</td><td>Enter the MongoDB database server name or IP address (Example: xxxx-xxxx.xxxx4ijtzasl.xx-south-1.rds.xxxxx.com or 1xx.xxx.1.x0).</td></tr><tr><td>Port*</td><td>By default, the port number for MongoDB, "27017," is auto-populated. If required, the port number can be modified as per the custom port number that is configured for the MongoDB.</td></tr><tr><td>Database*</td><td>Enter the database name to which the service account user has access within the MongoDB.</td></tr><tr><td>Driver*</td><td>By default, the MongoDB driver details are auto-populated.</td></tr><tr><td>Username*</td><td>Enter the service account username set up to access the MongoDB database (Example: "oesauser").</td></tr><tr><td>Password*</td><td>Enter the password associated with the service account user.</td></tr><tr><td>Connection String</td><td>Configure the connection string for the MongoDB database:<br>Automatic Mode: The system generates a connection string based on the provided credentials.<br><br>Manual Mode: Enter a valid connection string manually.<br><br>Replace placeholders with actual database details.<br>{sid} refers to Database Name.</td></tr><tr><td>Plugin Server</td><td>Enter the server’s name when running as a plugin server.</td></tr><tr><td>Plugin Port</td><td>Enter the port number on which the plugin is running.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

**Default Governance Roles**

<table data-header-hidden><thead><tr><th width="219.3333740234375"></th><th></th></tr></thead><tbody><tr><td>Default Governance Roles*</td><td>Select the appropriate users or teams for each governance role from the drop-down list. All users and teams configured in OvalEdge Security are displayed for selection.</td></tr></tbody></table>

**Admin Roles**

<table data-header-hidden><thead><tr><th width="219.3333740234375"></th><th></th></tr></thead><tbody><tr><td>Admin Roles*</td><td>Select one or more users from the dropdown list for Integration Admin and Security &#x26; Governance Admin. All users configured in OvalEdge Security are available for selection.</td></tr></tbody></table>

**No of Archive Objects**

<table data-header-hidden><thead><tr><th width="219.3333740234375"></th><th></th></tr></thead><tbody><tr><td>No Of Archive Objects*</td><td><p>This shows the number of recent metadata changes to a dataset at the source. By default, it is off. To enable it, toggle the Archive button and specify the number of objects to archive.</p><p>Example: Setting it to 4 retrieves the last four changes, displayed in the 'Version' column of the 'Metadata Changes' module.</p></td></tr></tbody></table>

**Bridge**

<table data-header-hidden><thead><tr><th width="220.6666259765625"></th><th></th></tr></thead><tbody><tr><td>Select Bridge*</td><td><p>If applicable, select the bridge from the drop-down list.</p><p>The drop-down list displays all active bridges configured in OvalEdge. These bridges enable communication between data sources and OvalEdge without altering firewall rules.</p></td></tr></tbody></table>

2. After entering all connection details, the following actions can be performed:
   1. Click **Validate** to verify the connection.
   2. Click **Save** to store the connection for future use.
   3. Click **Save & Configure** to apply additional settings before saving.
3. The saved connection will appear on the **Connectors home page.**

## Manage Connector Operations

### Crawl/Profile

{% hint style="warning" %}
To perform crawl and profile operations, users must be assigned the Integration Admin role.
{% endhint %}

The **Crawl/Profile** button allows users to select one or more schemas for crawling and profiling.&#x20;

1. Navigate to the **Connectors page** and click **Crawl/Profile**.
2. Select the schemas to crawl.
3. The **Crawl** option is selected by default. Click the **Crawl & Profile** radio button to run both operations.
4. Click **Run** to collect metadata from the connected source and load it into the **OvalEdge Data Catalog.**
5. After a successful crawl, the information appears in the **Data Catalog > Databases** tab.

The **Schedule** checkbox allows automated crawling and profiling at defined intervals, from a minute to a year.

1. Click the **Schedule** checkbox to enable the **Select** Period drop-down.
2. Select a time period for the operation from the drop-down menu.
3. Click **Schedule** to initiate metadata collection from the connected source.
4. The system will automatically execute the selected operation (**Crawl** or **Crawl & Profile**) at the scheduled time.

#### Other Operations

The **Connectors page** in OvalEdge provides a centralized view of all configured connectors, including their health status.

**Managing connectors includes:**

* **Connectors Health**: Displays the current status of each connector using a **green** icon for active connections and a **red** icon for inactive connections, helping to monitor the connectivity with data sources.
* **Viewing**: Click the **Eye** icon next to the connector name to view connector details, including databases, tables, columns, and codes.

**Nine Dots Menu Options:**

To view, edit, validate, configure, or delete connectors, click on the **Nine Dots** menu.

* **Edit Connector:** Update and revalidate the data source.
* **Validate Connector**: Check the connection's integrity.
* **Settings**: Modify connector settings.
  * **Crawler**: Configure data extraction.
  * **Profiler**: Customize data profiling rules and methods.
  * **Query Policies:** Define query execution rules based on roles.
  * **Access Instructions**: Add notes on how data can be accessed.
  * **Business Glossary Settings**: Manage term associations at the connector level.
  * **Anomaly Detection Settings**: Configure anomaly detection preferences at the connector level.
  * **Connection Pooling:** Allows configuring parameters such as maximum pool size, idle time, and timeouts directly within the application.
  * **Others**: Configure notification recipients for metadata changes.
* **Delete Connector**: Remove a connector with confirmation.

## Connectivity Troubleshooting

If incorrect parameters are entered, error messages may appear. Ensure all inputs are accurate to resolve these issues. If issues persist, contact the assigned support team.

<table><thead><tr><th width="86.3333740234375">S.No.</th><th width="176.66668701171875">Error Message(s)</th><th>Error Description &#x26; Resolution</th></tr></thead><tbody><tr><td>1</td><td>Authentication failed</td><td><p><strong>Description:</strong></p><p>The connection failed because the MongoDB credentials provided are incorrect or not properly configured.</p><p><strong>Resolution:</strong></p><ul><li>Verify the <strong>username</strong> matches the MongoDB user account.</li><li>Check the <strong>password</strong>, including case sensitivity and special characters (use URL encoding if needed).</li><li>Ensure the <strong>user account exists</strong> and has the required roles.</li><li>Confirm the <strong>authentication database</strong> (<code>admin</code>).</li><li>For <strong>MongoDB Atlas</strong>, ensure the connection string uses <code>mongodb+srv://</code>.</li><li>If using a <strong>credential manager</strong>, verify that stored credentials are correct and accessible.</li></ul></td></tr><tr><td>2</td><td>"Communications link failure" or "Connection timeout"</td><td><p><strong>Description:</strong></p><p>The connection failed due to network connectivity issues between the application and the MongoDB server.</p><p><strong>Resolution:</strong></p><ul><li>Verify the <strong>server IP/hostname</strong> is correct and reachable.</li><li>Ensure the <strong>port</strong> is correct (27017 for standalone; no port for Atlas).</li><li>Check that the <strong>MongoDB server is running</strong> and accessible.</li><li>Confirm <strong>firewall rules</strong> allow traffic on port 27017.</li><li>For <strong>MongoDB Atlas</strong>, ensure your <strong>IP is whitelisted</strong> in Network Access.</li><li>Test connectivity using <strong>ping</strong> or <strong>telnet &#x3C;server> &#x3C;port></strong>.</li><li>For Atlas, ensure the <strong>connection string</strong> uses <code>mongodb+srv://</code>.</li></ul></td></tr><tr><td>3</td><td>Database does not exist</td><td><p><strong>Description:</strong></p><p>The connection failed because the database name is incorrect or does not exist in MongoDB.<br><strong>Resolution:</strong></p><ul><li>Verify the <strong>database name (SID)</strong> is correct and exists.</li><li><p>Ensure the <strong>connection string</strong> is correctly formatted:</p><ul><li>Standalone: <code>mongodb://&#x3C;username>:&#x3C;password>@&#x3C;server>:&#x3C;port>/&#x3C;database></code></li><li>Atlas: <code>mongodb+srv://&#x3C;username>:&#x3C;password>@&#x3C;server>/&#x3C;database></code></li></ul></li><li>Connect using a MongoDB client and run <strong>show dbs</strong> to confirm the database exists.</li><li>Ensure the <strong>user has read/write permissions</strong> on the database.</li><li>Remember that MongoDB creates databases automatically, but proper <strong>permissions</strong> are still required.</li></ul></td></tr><tr><td>4</td><td>Failed to retrieve DataSource from DataSourceProvider</td><td><p><strong>Description:</strong></p><p>The issue occurs due to connection pool or data source initialization problems while creating the MongoDB connection.<br><strong>Resolution:</strong></p><ul><li>Ensure the connection string uses the correct format (mongodb:// or mongodb+srv://).</li><li>Verify the MongoDB Java driver is present in the classpath.</li><li>Confirm network connectivity to the MongoDB server.</li><li>Make sure the selected authentication type (Standalone or Service) matches your MongoDB setup.</li><li>Remove and re-add the connection to clear cached connection pool state.</li><li>Note that MongoDB uses MongoClient directly, not traditional JDBC pooling.</li></ul></td></tr></tbody></table>

## FAQs

<details>

<summary>Why are no databases visible during the crawl process?</summary>

This issue commonly occurs due to missing or incomplete access permission privileges. The following validations are required:

* The MongoDB user must have the **listDatabases** privilege or the **readAnyDatabase** role.
* The system retrieves database names using `mongoClient.listDatabaseNames()`, which requires the appropriate privileges.
* The user account must have at least **read** privileges on the relevant databases.
* MongoDB server logs should be reviewed for any access-related errors.
* The user account must be able to run the **show dbs** command in the Mongo shell.
* The MongoDB server must be active and reachable.
* For MongoDB Atlas, **IP whitelisting** and user privileges must be properly configured.

</details>

<details>

<summary>How to switch from database credentials to a credential manager?</summary>

To configure the connection using a credential manager, follow these steps:

* Select the required **Credential Manager type** from the dropdown (e.g., AWS Secrets Manager, HashiCorp Vault).
* Provide the **secret name or path** where the credentials are stored.
* The system retrieves the username, password, and connection details from the credential manager.
* Ensure the credential manager is correctly configured and accessible.
* Test the connection to confirm successful credential retrieval.
* For MongoDB Atlas, ensure the **connection string format** remains unchanged.

</details>

***

**Copyright © 2025, OvalEdge LLC, Peachtree Corners GA USA**
