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

# Database Connector

> Connect to PostgreSQL, MySQL, MS-SQL, Oracle, or MongoDB and read live at query time.

## Overview

The database connector connects to PostgreSQL, MySQL, MS-SQL, Oracle, or MongoDB.
It does not copy and store your data — it **reads live from the DB at query time.**
Because the DB provides column information, there is no header-row step (unlike the file connector).

> [!NOTE]
>
> This screen is available to **Manager and above** (owner, manager) only. Menu visibility `manage`.

## Steps

**1. Connect · tables**

Enter the connection details, use `Connect & list tables` to connect, and select a table or collection.

**2. Data view · filter**

Review the preview and add filters so only matching rows are used.

**3. Field mapping**

For each column, set a Meaning (required, standard field name) and Detail (optional).

**4. Register**

Enter a name and register the data source.

## Connection details (SQL)

| Field | Description |
| - | - |
| Host | DB server address |
| Port | Defaults — PostgreSQL `5432` · MySQL `3306` · MS-SQL `1433` · Oracle `1521` · MongoDB `27017` |
| Database | Target database |
| Schema (optional) | Schema selection (except MongoDB) |
| User | Connection account |
| Password | Connection password (stored AES-256-GCM encrypted) |

### SSL / TLS

| Mode | Description |
| - | - |
| Disabled | No encryption |
| Encrypt (require) | Transport encryption only |
| Verify CA (verify-ca) | Verify the server CA certificate (PEM) |
| Verify CA + host (verify-full) | Verify CA plus the host name |

> [!NOTE]
>
> Verify modes (verify-ca, verify-full) require a server CA certificate (PEM).

### SSH tunnel (optional)

Connect to the DB through a bastion host. Fields: bastion host, port, user, and authentication method (private key PEM or password). Credentials are stored encrypted.

## Reading data

**Table (SQL)**

Select a table to query, or write a **custom query**. Custom queries allow only `SELECT` / `WITH` (read-only), and a simple builder can generate a basic `SELECT` statement.

**MongoDB**

Select a collection and choose the source mode.

* **Collection sample**: read a sample from the collection.
* **Aggregation pipeline**: write a pipeline as a JSON array. `$out` and `$merge` are not allowed (read-only).

## Security · editing

> [!WARNING]
>
> The password is **encrypted with AES-256-GCM** and is never returned to the client.
> When editing, leaving the password field blank keeps the stored value.

> [!NOTE]
>
> In the edit screen the connection target (host, port, database, user) is read-only; only the security settings (SSL, SSH tunnel) and the password can be changed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.