
## How Atlan connects to MongoDB (self-managed)

URL: https://docs.atlan.com/apps/connectors/database/mongodb/onprem/concepts/how-atlan-connects-to-mongodb-onprem

> Understand how Atlan securely connects to your MongoDB (self-managed) database to extract metadata.

Atlan connects to your MongoDB database to extract technical metadata while maintaining network security and compliance. You can choose between Direct connectivity for databases available from the internet or Self-deployed runtime for databases that must remain behind your firewall.

## Connect via direct network connection

Atlan's MongoDB workflow establishes a direct network connection to your database from the Atlan SaaS tenant. This approach works when your MongoDB database can accept connections from the internet.

```mermaid
sequenceDiagram
 participant User as User
 participant Atlan as Atlan SaaS Tenant
 participant MongoDB as MongoDB

 User->>Atlan: Provide connection details (host, port, db, credentials)
 Atlan->>MongoDB: Establish direct connection (default port 27017)
 Atlan->>MongoDB: Execute read-only queries for metadata discovery
 MongoDB-->>Atlan: Return metadata structure (databases, Collections, schemas)
 Atlan-->>User: Catalog results in Atlan Cloud
```

- Atlan's MongoDB workflow connects directly to your database from the Atlan SaaS tenant over port 27017 (default).
- Your MongoDB database accepts inbound network connections from Atlan's IP addresses, controlled through your firewall rules or network security groups.

For details on how direct connectivity works, see [Direct connectivity](https://docs.atlan.com/llms/catalog/connector-capabilities/direct-connectivity/llms.txt).

## Connect via self-deployed runtime

A runtime service deployed within your network acts as a secure bridge between Atlan Cloud and your MongoDB database. This approach works when your MongoDB database must remain fully isolated behind your firewall.
```mermaid
sequenceDiagram
 participant Runtime as Self-Deployed Runtime
 participant SecretStore as Secret Store
 participant MongoDB as MongoDB
 participant User as User
 participant Atlan as Atlan Cloud

 User->>Atlan: Configure crawler workflow (non-sensitive connection details)
 Atlan->>Runtime: Send metadata extraction request (via outbound HTTPS)
 Runtime-->>SecretStore: Request sensitive connection details (password, private keys)
 SecretStore-->>Runtime: Return sensitive connection details (password, private keys)
 Runtime->>MongoDB: Establish local connection (default port 27017)
 Runtime->>MongoDB: Execute read-only queries for metadata discovery
 MongoDB-->>Runtime: Return metadata structure (databases, Collections, schemas)
 Runtime-->>Atlan: Send metadata results (via HTTPS)
 Atlan-->>User: Catalog results in Atlan Cloud
```
- The runtime maintains an outbound HTTPS connection to Atlan Cloud (port 443) and a local network connection to your MongoDB database (port 27017).
- The runtime translates requests into MongoDB queries, executes them on your MongoDB database, and returns the results to Atlan Cloud.

For details on how Self-Deployed Runtime works, see [SDR connectivity](https://docs.atlan.com/llms/catalog/connector-capabilities/sdr-connectivity/llms.txt).

## Security

Atlan extracts only structural metadata—databases, Collections, and their schemas. For example, if you have a `customers` Collection with customer records, Atlan discovers the Collection structure and schema definitions, but never queries or stores the customer records themselves.

- **Read-only operations**: All database queries are read-only operations. The connector can't modify data, create or drop database objects, or change any configuration. The MongoDB user permissions you grant control exactly what the connector can access.

- **Credential encryption**: MongoDB connection credentials are encrypted at rest and in transit. In Direct connectivity, Atlan encrypts credentials before storage. In Self-deployed runtime, credentials never leave your network perimeter—the runtime retrieves them from your enterprise-managed secret vaults (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager, or HashiCorp Vault) only when needed, and Atlan Cloud never receives or stores them.

- **Network isolation with Self-deployed runtime**: Your MongoDB database gains complete network isolation from the internet. The database only accepts connections from the runtime within your local network. The runtime itself only makes outbound HTTPS connections to Atlan Cloud, which your network team can control through firewall rules.

## See also

* [Direct connectivity](https://docs.atlan.com/llms/catalog/connector-capabilities/direct-connectivity/llms.txt): How Atlan connects directly to data sources
* [SDR connectivity](https://docs.atlan.com/llms/catalog/connector-capabilities/sdr-connectivity/llms.txt): How Self-Deployed Runtime connects to data sources
* [Set up MongoDB (self-managed)](https://docs.atlan.com/llms/connectors/mongodb-onprem/set-up-mongodb-onprem/llms.txt): Configure user accounts and permissions

---
