Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data migration tool for MongoDB [closed]

Tags:

mongodb

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.

like image 915
Rini Avatar asked Aug 04 '16 13:08

Rini


2 Answers

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.

like image 106
lrathod Avatar answered Sep 28 '22 03:09

lrathod


Mongeez seems to be a dead project. You can try Mongobee instead.

like image 20
Danylo Zatorsky Avatar answered Sep 28 '22 01:09

Danylo Zatorsky