Skip to content

feature(mongodb): Added support for MongoDB Go driver v2 - #1447

Open
0xshamaiev wants to merge 2 commits into
golang-migrate:masterfrom
0xshamaiev:master
Open

0xshamaiev wants to merge 2 commits into
golang-migrate:masterfrom
0xshamaiev:master

Conversation

@0xshamaiev

@0xshamaiev 0xshamaiev commented Sep 21, 2026 •

Copy link
Copy Markdown

What changed

Adds database/mongodb/v2 for applications using MongoDB Go driver v2,
following the separate versioned-backend pattern used by PGX.
The v2 driver backend is 95% similar to v1, so it's mostly mechanical API changes.

  • The existing MongoDB v1 backend, API, and URL schemes are kept in place.
  • Added mongodb2:// and mongodb2+srv:// schemes.
  • Added the mongodb2 CLI build tag and included it in default builds.
  • Document usage and add tests for driver registration, SRV scheme
    handling, shared migration version records, and advisory locking.

Testing

  • Lint and all-package compilation passed.
  • Core tests and CLI build/startup checks passed.
  • MongoDB 5.0–9.0 integration tests passed with race detection.
  • Transaction commit and rollback tests passed on MongoDB 5.0.

@0xshamaiev

Copy link
Copy Markdown
Author

@Fontinalis @dhui this should resolve #1368 and doesn't break compatibility for projects that will still use the v1 driver.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 55.67%. first build — 0xshamaiev:master into golang-migrate:master

@0xshamaiev

Copy link
Copy Markdown
Author

@Fontinalis , hey, I ran all the checks locally and can confirm they pass. Something is wrong with SQL Server 2025 tests; they must be failing my PR's CI.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants