Skip to content

feat: add MongoDB driver support #480

Description

@anandgupta42

Summary

Add MongoDB as the 11th supported warehouse/database driver in altimate-code. MongoDB is a document database — unlike SQL drivers, it uses the MongoDB Query Language (MQL) and has different concepts (databases → collections → documents instead of schemas → tables → rows).

Motivation

  • DataAgentBench (DAB): 2 of 12 datasets in the DAB benchmark (UC Berkeley) require MongoDB. Without MongoDB support, altimate-code cannot compete on the full benchmark.
  • Enterprise coverage: MongoDB is widely used in enterprise data stacks. Supporting it completes our coverage of the most common data stores.

Implementation Plan

Driver (packages/drivers/src/mongodb.ts)

  • Uses the mongodb npm package (official Node.js driver)
  • Maps MongoDB concepts to the existing Connector interface:
    • listSchemas() → lists databases
    • listTables(schema) → lists collections in a database
    • describeTable(schema, table) → samples documents to infer field types
    • execute(query) → parses and executes MQL commands (find, aggregate, insertMany, etc.)
  • Query language: accepts JSON-based MQL strings (not SQL)

Registration

  • Add to packages/drivers/src/index.ts
  • Add to packages/drivers/src/normalize.ts (aliases: mongomongodb)
  • Add to packages/opencode/src/altimate/native/connections/registry.ts
  • Add mongodb to packages/drivers/package.json optionalDependencies

CI Integration

  • Add MongoDB service to .github/workflows/ci.yml driver-e2e job
  • Add change detection for new test file

Testing (extensive)

  • E2E tests with Dockerized MongoDB (or CI service)
  • Schema introspection tests (databases, collections, field inference)
  • CRUD operations via MQL
  • Aggregation pipeline tests
  • Adversarial tests: malformed queries, injection attempts, huge documents, deeply nested objects, mixed-type fields, empty collections, special characters in names

Acceptance Criteria

  • MongoDB driver implements full Connector interface
  • Config normalization handles mongo/mongodb aliases and common field name variants
  • Registry maps mongodb and mongo to the driver
  • E2E tests pass against Dockerized MongoDB in CI
  • Adversarial tests cover edge cases
  • Connection string support (mongodb:// URIs)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions