MongoDB - Native Connectors
Published 15 January 2025
- Status: Preview
- Verified Versions: V5,V8
- Maintainer: Redgate
Supported Versions and Support Levels
- For information regarding the supported version and support levels available, please see Supported Databases for Flyway
- For information regarding the Flyway features available, please see Flyway feature summary
Terminology
We have to map Flyway concepts and language rooted in the relational database world to MongoDB - this is how Flyway sees the mapping:
MongoDB Concept | Flyway Concept |
---|---|
database | database/schema |
collection | table |
row | document |
transaction | transaction |
Using Flyway with MongoDB Native Connectors
- If you are using javascript migrations then you'll need
mongosh
to be installed. If you are not using the default database, you will need to include the database name and auth source in your url. - Any configuration you require needs to go into the connection string (Flyway's URL parameter) - see Mongo Connection String Options. This is to enable the same configuration to be applied whether Flyway is talking to the database through the API or via Mongosh.
- There is a tutorial available here.
Limitations
- Transactions using
.js
migrations will not work. A warning will be displayed ifexecuteInTransaction
is set. See this blog post for more details.