I'm looking for a data migration tool for MongoDB, something like Liquibase or Flyway, that is compatible with Mongo 3.0.
Any recommendations?
Thanks.
I have used Mongobee while working with MongoDB and neeeded something similar to flyway. Does the job and easy to configure.
Add Maven dependency
<dependency>
<groupId>com.github.mongobee</groupId>
<artifactId>mongobee</artifactId>
</dependency>
you will need to create the bean for Mongobee in your context xml file
<bean id="mongobee" class="com.github.mongobee.Mongobee">
<constructor-arg ref="mongo"/>
<property name="dbName" value="${mongo.databaseName}"/>
<property name="enabled" value="true"/>
<property name="changeLogsScanPackage" value="basepackagewherechangesetispresent"/>
Now add changeset class
@ChangeLog(order = "1")
public class DatabaseChangeLog {
@ChangeSet(order = "101", id = "somelogicalnameforthischangeset", author = "nameofpersonwhodidthischange")
public void setupSeedData(MongoTemplate mongoTemplate) {
// run your datasetup, prefill,migration here.
}
And just like flyway, it also maintains the schema version table, so that same change set does not ran again in same environment.
Mongeez seems to be a dead project. You can try Mongobee instead.
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