When its RDBMS, I used Liquibase to deploy the changes in the target database. That has support for multi-tenancy & roll back to different versions.
In Mongo, I tried to find the equivalent library and found the below.
For me the criteria are,
You have some other working concept, eager to know. Thanks,
A.
The mongodb extension for Liquibase just came out. Since you are familiar with Liquibase you might the extension. https://github.com/liquibase/liquibase-mongodb
If you are using Java, a very good option(I'd say probably the best) is Mongock.
It provides everything you need and there are very good features in the road map.
To get started(if using Spring 5 and spring data 3), you just need :
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.cloudyrock.mongock</groupId>
<artifactId>mongock-bom</artifactId>
<version>4.1.17</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- ... -->
<dependency>
<groupId>com.github.cloudyrock.mongock</groupId>
<artifactId>mongock-spring-v5</artifactId>
</dependency>
<dependency>
<groupId>com.github.cloudyrock.mongock</groupId>
<artifactId>mongodb-springdata-v3-driver</artifactId>
</dependency>
mongock:
change-logs-scan-package:
- your.package.for.changelogs
your.package.for.changelogs
@ChangeLog(order = "001")
public class DatabaseChangelog {
@ChangeSet(order = "001", id = "changeWithoutArgs", author = "mongock")
public void yourChangeSet() {
// your migration here
}
}
@EnableMongock
@SpringBootApplication
public class App {
public static void main(String[] args) {
new SpringApplicationBuilder().sources(App.class).run(args);
}
}
This is only a quick introduction on how it works. Please a look to the documentation for more information.
Disclosure: I am one of the Mongock authors.
There is this one - mongock.io which is similar like how Liquibase work and works perfectly. Below is the github URL: https://github.com/cloudyrock/mongock
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With