Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- 'packages/opencode/src/altimate/native/connections/**'
- 'packages/opencode/test/altimate/drivers-e2e.test.ts'
- 'packages/opencode/test/altimate/drivers-docker-e2e.test.ts'
- 'packages/opencode/test/altimate/drivers-mongodb-e2e.test.ts'
- 'packages/opencode/test/altimate/connections.test.ts'
dbt-tools:
- 'packages/dbt-tools/**'
Expand Down Expand Up @@ -155,6 +156,16 @@ jobs:
--health-timeout 5s
--health-retries 10

mongodb:
image: mongo:7.0
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.runCommand({ping:1})' --quiet"
--health-interval 5s
--health-timeout 5s
--health-retries 10

steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

Expand Down Expand Up @@ -195,6 +206,13 @@ jobs:
TEST_REDSHIFT_PORT: "15439"
TEST_REDSHIFT_PASSWORD: testpass123

- name: Run MongoDB driver E2E
run: bun test test/altimate/drivers-mongodb-e2e.test.ts
working-directory: packages/opencode
env:
TEST_MONGODB_HOST: 127.0.0.1
TEST_MONGODB_PORT: "27017"

# Cloud tests NOT included — they require real credentials
# Run locally with:
# ALTIMATE_CODE_CONN_SNOWFLAKE_TEST='...' bun test test/altimate/drivers-snowflake-e2e.test.ts
Expand Down
25 changes: 25 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 46 additions & 1 deletion docs/docs/configure/warehouses.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Warehouses

Altimate Code connects to 8 warehouse types. Configure them in `.altimate-code/connections.json` (project-local) or `~/.altimate-code/connections.json` (global).
Altimate Code connects to 9 warehouse types. Configure them in `.altimate-code/connections.json` (project-local) or `~/.altimate-code/connections.json` (global).

## Configuration

Expand Down Expand Up @@ -237,6 +237,51 @@ If you're already authenticated via `gcloud`, omit `credentials_path`:
| `ssl_cert` | No | Path to client certificate file |
| `ssl_key` | No | Path to client key file |

## MongoDB

```json
{
"my-mongodb": {
"type": "mongodb",
"host": "localhost",
"port": 27017,
"database": "analytics",
"user": "analyst",
"password": "{env:MONGO_PASSWORD}"
}
}
```

| Field | Required | Description |
|-------|----------|-------------|
| `connection_string` | No | Full connection string (alternative to individual fields) |
| `host` | No | Hostname (default: `127.0.0.1`) |
| `port` | No | Port (default: `27017`) |
| `database` | No | Database name |
| `user` | No | Username |
| `password` | No | Password |
| `auth_source` | No | Authentication database (default: `admin`) |
| `replica_set` | No | Replica set name |
| `tls` | No | Enable TLS (default: `false`) |
| `direct_connection` | No | Connect directly to a single host |

### Using a connection string

```json
{
"my-mongodb": {
"type": "mongodb",
"connection_string": "mongodb://analyst:secret@localhost:27017/analytics"
}
}
```

!!! note
MongoDB uses MQL (MongoDB Query Language) instead of SQL. Queries are submitted as JSON objects via the `execute` method. Supported commands: `find`, `aggregate`, `countDocuments`, `distinct`, `insertOne`, `insertMany`, `updateOne`, `updateMany`, `deleteOne`, `deleteMany`, `createIndex`, `listIndexes`, `createCollection`, `dropCollection`, `ping`.

!!! info "Server compatibility"
The MongoDB driver (v6.x) supports MongoDB server versions 3.6 through 8.0, covering all releases from the last 3+ years.

## SQL Server

```json
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/data-engineering/tools/warehouse-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ env_bigquery | bigquery | GOOGLE_APPLICATION_CREDENTIALS
| Databricks | `DATABRICKS_HOST`, `DATABRICKS_SERVER_HOSTNAME` |
| PostgreSQL | `PGHOST`, `PGDATABASE`, `DATABASE_URL` |
| MySQL | `MYSQL_HOST`, `MYSQL_DATABASE` |
| MongoDB | `MONGODB_URI`, `MONGO_URL` |
| Redshift | `REDSHIFT_HOST` |

### Parameters
Expand Down Expand Up @@ -164,7 +165,7 @@ Remove an existing warehouse connection.

## warehouse_discover

Discover database containers running in Docker. Detects PostgreSQL, MySQL/MariaDB, and SQL Server containers with their connection details.
Discover database containers running in Docker. Detects PostgreSQL, MySQL/MariaDB, SQL Server, and MongoDB containers with their connection details.

```
> warehouse_discover
Expand Down
16 changes: 14 additions & 2 deletions docs/docs/drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

Altimate Code connects to 10 databases natively via TypeScript drivers. No Python dependency required. Drivers are loaded lazily, so only the driver you need is imported at runtime.
Altimate Code connects to 11 databases natively via TypeScript drivers. No Python dependency required. Drivers are loaded lazily, so only the driver you need is imported at runtime.

## Support Matrix

Expand All @@ -17,6 +17,7 @@ Altimate Code connects to 10 databases natively via TypeScript drivers. No Pytho
| Snowflake | `snowflake-sdk` | Password, Key-Pair (unencrypted + encrypted), OAuth | ✅ Live account | 37 E2E tests, key-pair with passphrase support |
| BigQuery | `@google-cloud/bigquery` | Service Account, ADC | ✅ Live account | 25 E2E tests, UNNEST/STRUCT/DATE types |
| Databricks | `@databricks/sql` | PAT, OAuth | ✅ Live account | 24 E2E tests, Unity Catalog support |
| MongoDB | `mongodb` | Password, Connection String | ✅ Docker | 90 E2E tests, MQL queries, aggregation pipelines |
| Oracle | `oracledb` (thin) | Password | ❌ Needs Oracle 12.1+ | Thin mode only, no Instant Client |

## Installation
Expand All @@ -33,6 +34,9 @@ bun add pg # PostgreSQL + Redshift
bun add mysql2 # MySQL
bun add mssql # SQL Server

# Document databases
bun add mongodb # MongoDB

# Cloud warehouses
bun add snowflake-sdk # Snowflake
bun add @google-cloud/bigquery # BigQuery
Expand Down Expand Up @@ -129,6 +133,14 @@ altimate-dbt init --project-root /path/to/dbt/project --python-path $(which pyth
|--------|--------------|
| Password | `host`, `port`, `service_name`, `user`, `password` |

### MongoDB
| Method | Config Fields |
|--------|--------------|
| Password | `host`, `port`, `database`, `user`, `password` |
| Connection String | `connection_string: "mongodb://user:pass@host:port/db"` |

MongoDB supports server versions 3.6 through 8.0. Queries use MQL (MongoDB Query Language) via JSON, not SQL. The driver supports `find`, `aggregate`, CRUD operations, index management, and schema introspection via document sampling.

### DuckDB
| Method | Config Fields |
|--------|--------------|
Expand Down Expand Up @@ -167,7 +179,7 @@ SSH auth types: `"key"` (default) or `"password"` (set `ssh_password`).

The CLI auto-discovers connections from:

1. **Docker containers**: detects running PostgreSQL, MySQL, MariaDB, SQL Server, Oracle containers
1. **Docker containers**: detects running PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, MongoDB containers
2. **dbt profiles**: parses `~/.dbt/profiles.yml` for all supported adapters
3. **Environment variables**: detects `SNOWFLAKE_ACCOUNT`, `PGHOST`, `MYSQL_HOST`, `MSSQL_HOST`, `ORACLE_HOST`, `DUCKDB_PATH`, `SQLITE_PATH`, etc.

Expand Down
3 changes: 2 additions & 1 deletion packages/drivers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"mysql2": "^3.0.0",
"mssql": "^11.0.0",
"oracledb": "^6.0.0",
"duckdb": "^1.0.0"
"duckdb": "^1.0.0",
"mongodb": "^6.0.0"
Comment on lines +19 to +20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

What is the latest stable version of the mongodb npm package?

💡 Result:

The latest stable version of the mongodb npm package is 7.1.1.

Citations:


Update mongodb package to latest stable version.

The mongodb ^6.0.0 constraint excludes the latest stable release (7.1.1). Update to ^7.0.0 to include security patches and bug fixes from the latest major version.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/drivers/package.json` around lines 19 - 20, Update the mongodb
dependency version in packages/drivers/package.json from "mongodb": "^6.0.0" to
"mongodb": "^7.0.0" so the project can pull the latest stable 7.x releases;
after changing the dependency string, run your package manager to update the
lockfile (npm/yarn/pnpm install) and run the test suite/build to ensure no
breaking API changes affect code using the MongoClient or other mongodb-related
symbols.

}
}
2 changes: 1 addition & 1 deletion packages/drivers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Re-export types
export type { Connector, ConnectorResult, SchemaColumn, ConnectionConfig } from "./types"


// Re-export config normalization
export { normalizeConfig } from "./normalize"

Expand All @@ -16,3 +15,4 @@ export { connect as connectSqlserver } from "./sqlserver"
export { connect as connectOracle } from "./oracle"
export { connect as connectDuckdb } from "./duckdb"
export { connect as connectSqlite } from "./sqlite"
export { connect as connectMongodb } from "./mongodb"
Loading
Loading