Skip to content

feat: Add MongoDB Connector Support #107

Description

@ReginaldErzoah

Summary

Add MongoDB connector support to Dift.


Motivation

Dift currently supports local files, SQL databases, and warehouse-style connectors.

MongoDB support would expand Dift into NoSQL and document database workflows, enabling users to compare document collections across environments.

This is useful for:

  • production vs staging collection comparison
  • document schema drift detection
  • NoSQL data validation
  • JSON-like dataset comparison
  • application data regression testing

Proposed Improvements

  • Add MongoDB URI support
  • Add MongoDB collection reader
  • Load MongoDB documents into a comparable format
  • Integrate MongoDB with the reader registry system
  • Provide helpful dependency and connection errors

Suggested Files

Potential implementation areas:

dift/io/mongodb_reader.py
dift/io/readers.py
dift/io/registry.py
dift/io/base_reader.py
tests/test_mongodb_reader.py
docs/connectors/mongodb.md

Suggested Tasks

  • Add MongoDB URI detection
  • Add MongoDB collection parsing
  • Add MongoDB reader implementation
  • Register MongoDB reader in the reader registry
  • Add dependency guidance for MongoDB support
  • Add tests
  • Update documentation

How to Test

Install MongoDB driver:

pip install pymongo

Run:

pytest
ruff check .

Run targeted tests:

pytest tests/test_mongodb_reader.py

Manual validation example:

dift mongodb://localhost:27017/app.users_old \
     mongodb://localhost:27017/app.users_new \
     --key user_id

Verify:

  • MongoDB URIs are routed to the MongoDB reader
  • collections load successfully
  • helpful errors appear for missing drivers
  • existing file, SQL, DuckDB, and BigQuery workflows remain stable

Documentation Impact

Create:

docs/connectors/mongodb.md

Update:

docs/connectors/index.md
docs/roadmap.md
mkdocs.yml

Documentation should include:

  • MongoDB URI format
  • dependency installation
  • collection comparison examples
  • authentication guidance
  • limitations and caveats

Acceptance Criteria

  • MongoDB connector exists
  • MongoDB collections can be loaded for comparison
  • Reader registry routes MongoDB URIs correctly
  • Tests pass
  • Documentation updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions