2 Getting Started - Reference Documentation
Authors: David M. Carr
Version: 0.2.1
2 Getting Started
Installation
Install the plugin by adding the following to yourBuildConfig.groovy (replace VERSION with the desired version):plugins {
…
compile ':mongeez:VERSION'
}Configuration
At a minimum, the plugin needs to know how to connect to your database. If you use the MongoDB GORM plugin, it should use the same database configuration. Otherwise, it will attempt to use intelligent defaults. See Configuration for instructions on how to override the defaults.Changelog Creation
Next, you'll need to create some changelogs. Currently two formats are supported; JavaScript or XML. The Javascript format is recommended, as it's closer to writing plain MongoDB migration scripts. Documentation of the XML format can be found here. By default, changelog files go ingrails-app/migrations.When using the JavaScript format, start each file with a comment "//mongeez formatted javascript". Then add one or more
changeset sections, with a "//changeset AUTHOR:ID" comment at the start of each changeset. Replace AUTHOR with some
way to identify the creator of the changeset and replace ID with an identifier for the changeset. If you want a
changeset to be run every update (rather than only once), include "runAlways:true" in the changeset comment.For example:
//mongeez formatted javascript
//changeset bob:1
db.TestCollection.insert({"someField1": "firstChangeSetData"});
//changeset bob:2
db.TestCollection.update({}, {$set: {"someField2": "secondChangeSetData"}}, false, true);
//changeset alice:3 runAlways:true
db.TestCollection.update({"someField1": {$exists: 1}}, {$set: {"someField1": "thirdChangeSetData"}}, false, true);grails mongeez-update