based on the sql evolution plugin from Typesafe Inc.
This plugin helps to run evolutions on mongodb databases. It uses mongo scripts written in javascript to migrate existing data to a new format. The plugin executes the scripts using the mongo console. It works the same way as the integrated sql evolutions do.
The evolution scripts need to be placed into conf/evolutions/XXX.js
, where XXX
denotes the evolution number (must be a valid integer). Evolutions will be executed in ascending order.
The package is published to sonatype and should get synced to maven central.
You need to add the package as a dependency:
libraryDependencies += "com.scalableminds" %% "play-mongev" % "0.4.1"
After adding the dependency, you need to load the plugin by adding this line to
your conf/play.plugins
file:
100:com.scalableminds.mongev.MongevPlugin
Make sure the plugin gets loaded before your mongo db driver.
Key | Description | |
---|---|---|
mongodb.evolution.enabled |
Boolean, optional, defaults to false |
set to true to enable mongodb evolutions |
mongodb.evolution.mongoCmd |
String, required if enabled | cmd used to call mongo from cmd, eg. mongo localhost:27017/test . You need to include the server and db name. |
mongodb.evolution.applyProdEvolutions |
Boolean, optional, defaults to false |
optionally enable/disable evolutions in production mode (enables only up evolutions) |
mongodb.evolution.applyDownEvolutions |
Boolean, optional, defaults to false |
optionally enable/disable down evolutions in production mode |