Since MongoDB does not perform (as in clause 2.6) any forced execution of the server-side scheme, data transfer scripts are not strictly required. This can be especially useful for development speed.
However, it might make sense to create a migration for your production data if you want to practice “data hygiene” and ensure consistency between different deployments.
For instance:
- delete unused fields
- add new required fields
- setting defaults
- rename fields
- Download required data / fixtures
- providing required indices
Of course, you have the choice to make any of the above as one-time scripts or to handle exceptions in the application code. For example, you can lazily add missing fields or default values as documents are loaded from the database for editing.
For Mongoid in particular, you can try the mongoid_rails_migrations gem.
source share