Migrating a Rails app from MySQL to MongoDB
I have a fairly simple rails app (a few controllers, views, gem requirements, etc.) that currently runs on MySQL. We are considering migrating th开发者_StackOverflow中文版e application to MongoDB. The app hasn't gone live, so we don't have any data to migrate. The app is running on ruby 1.9.2 and Rails 3, if that is relevant.
We were also considering using both MySQL and MongoDB together. What, if anything, should we know about using both databases?
There are no cache sweepers if you switch to Mongoid from ActiveRecord. Also it will be harder to work with grouping data functions. You'll need to use map/reduce or something like that. Other than that I can't think of any downsides. You'll love MongoDB.
UPD: Start MongoDB with --journal flag :) It will make your life simple and easy after server crash.
精彩评论