> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Unmanaged MongoDB

> Connect to externally managed MongoDB instances as a data source in FlowX workflows.

## Overview

Unmanaged MongoDB is a data source type that lets you connect FlowX workflows to **external MongoDB databases that your organization manages independently**. Unlike the built-in [FlowX Database](./flowx-database) — which provisions and manages MongoDB collections automatically — Unmanaged MongoDB connects to existing databases and collections you control.

<CardGroup cols={2}>
  <Card title="Use your infrastructure" icon="server">
    Connect to MongoDB instances you already manage, including Atlas, self-hosted, or cloud-managed deployments
  </Card>

  <Card title="Same operations" icon="arrows-rotate">
    Use the same CRUD operations (find, insert, update, delete) as FlowX Database
  </Card>

  <Card title="Connection discovery" icon="magnifying-glass">
    Browse available databases and collections directly from the Designer after connecting
  </Card>

  <Card title="Connection pooling" icon="gauge-high">
    Configure pool size, idle timeouts, and maintenance frequency per data source
  </Card>
</CardGroup>

***

## Managed vs unmanaged MongoDB

| Aspect                  | FlowX Database (managed)                          | Unmanaged MongoDB                                                                |
| ----------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------- |
| **Collection creation** | Automatic — FlowX creates and manages collections | Manual — you provide an existing collection                                      |
| **Schema management**   | Defined in FlowX Designer                         | Optional — you manage schemas externally                                         |
| **Index management**    | CRUD via Designer UI                              | You manage indexes externally                                                    |
| **Connection**          | Internal, handled by FlowX                        | You provide a connection URI                                                     |
| **Auth**                | Internal                                          | Username/password (SCRAM-SHA-256), or credentials embedded in the connection URI |
| **Use case**            | Data sharing between FlowX processes              | Integrate with existing MongoDB infrastructure                                   |

<Tip>
  Use **FlowX Database** when you need FlowX to manage the full lifecycle of your data. Use **Unmanaged MongoDB** when you need to read from or write to databases that exist outside FlowX.
</Tip>

<Note>
  Both [FlowX Database](./flowx-database) (managed) and Unmanaged MongoDB are served by the same **nosql-db-runner** service. Managed collections are stored in nosql-db-runner's own MongoDB database, while an Unmanaged MongoDB data source opens a separate, isolated connection to the external instance you specify — it never touches nosql-db-runner's internal database. Point it at infrastructure you own and manage.
</Note>

***

## Prerequisites

* A MongoDB 6.0+ instance accessible from your FlowX deployment
* An existing database and collection on the target instance
* A MongoDB user with appropriate permissions (read, write, or both)
* Network connectivity between FlowX services and the MongoDB instance
* For TLS/SSL connections: appropriate certificates configured on the MongoDB instance

***

## Creating an Unmanaged MongoDB data source

<Frame>
  ![Unmanaged MongoDB data source configuration](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/5.6/unmanaged_mongo.png)
</Frame>

<Steps>
  <Step title="Open Data Sources">
    Navigate to **Integrations** → **Data Sources** in your project.
  </Step>

  <Step title="Create a new data source">
    Click **New Data Source** and select **Unmanaged MongoDB** as the type.
  </Step>

  <Step title="Configure the connection">
    Enter the MongoDB connection URI:

    ```
    mongodb+srv://username:password@cluster.example.net
    ```

    Or standard format:

    ```
    mongodb://username:password@host:27017
    ```
  </Step>

  <Step title="Test the connection">
    Click **Test Connection** to verify connectivity and credentials.
  </Step>

  <Step title="Select database and collection">
    After a successful connection test, browse available databases and select the target database. Then browse and select the target collection.
  </Step>

  <Step title="Configure authorization (optional)">
    In the **Authorization** tab, configure authentication if not embedded in the connection URI.
  </Step>

  <Step title="Save">
    Click **Save** to create the data source.
  </Step>
</Steps>

<Warning>
  The target collection must already exist on the MongoDB instance. FlowX does not create collections on unmanaged databases.
</Warning>

***

## Connection pool configuration

Each Unmanaged MongoDB data source has its own connection pool. You can tune pool settings in the data source **Settings** tab:

| Setting                   | Description                                             | Default             |
| ------------------------- | ------------------------------------------------------- | ------------------- |
| **Min pool size**         | Minimum number of connections maintained                | `0`                 |
| **Max pool size**         | Maximum number of concurrent connections                | `100`               |
| **Max idle time**         | How long an idle connection stays open                  | `60000` ms (1 min)  |
| **Max lifetime**          | Maximum lifetime of a connection                        | `0` (unlimited)     |
| **Wait queue timeout**    | How long a request waits for an available connection    | `120000` ms (2 min) |
| **Maintenance frequency** | How often the pool checks for idle connections to close | `60000` ms (1 min)  |

<Tip>
  For production workloads, set **Min pool size** to match your baseline concurrent usage to avoid connection warm-up latency.
</Tip>

***

## Operations

Unmanaged MongoDB supports the same operations as [FlowX Database](./flowx-database):

| Operation    | Description                                   |
| ------------ | --------------------------------------------- |
| `find`       | Retrieve multiple documents based on criteria |
| `findOne`    | Retrieve a single document                    |
| `insertOne`  | Add a single document                         |
| `insertMany` | Add multiple documents at once                |
| `updateOne`  | Modify a single document                      |
| `updateMany` | Modify multiple documents at once             |
| `deleteOne`  | Remove a single document                      |
| `deleteMany` | Remove multiple documents at once             |

Operations are configured the same way as FlowX Database operations — with filters, projections, sorting, and parameter substitution using `${paramName}` syntax. You can test operations directly in the Designer before using them in workflows.

The **Documents** tab on the data source page lets you browse documents in the collection with pagination, filtering, and sorting.

For details on configuring each operation, see the [FlowX Database operations documentation](./flowx-database#mongodb-operations-supported).

***

## Using in workflows

Unmanaged MongoDB data sources are used in workflows the same way as other data sources:

<Steps>
  <Step title="Create operations">
    Define operations on the data source (find, insert, update, delete).
  </Step>

  <Step title="Add a Data Source node">
    Add a **Data Source** node to your workflow.
  </Step>

  <Step title="Select the data source">
    Select the Unmanaged MongoDB data source and operation.
  </Step>

  <Step title="Map parameters">
    Map input/output parameters in the data mapper.
  </Step>
</Steps>

***

## Deployment

No additional microservices are required. Unmanaged MongoDB uses the existing **nosql-db-runner** service to execute operations against your external MongoDB instance.

Ensure the `nosql-db-runner` service has network access to your MongoDB instance. If your MongoDB is behind a firewall, configure the appropriate network rules.

***

## Related resources

<CardGroup cols={2}>
  <Card title="FlowX Database" icon="database" href="./flowx-database">
    Managed MongoDB data storage within FlowX
  </Card>

  <Card title="Integration Designer" icon="diagram-project" href="./integration-designer">
    Overview of all data source types and workflow building
  </Card>

  <Card title="NoSQL DB Runner setup" icon="gear" href="/5.9/setup-guides/nosql-db-runner">
    Deployment configuration for the database runner service
  </Card>
</CardGroup>
