Prevent Mongoid Memory Leaks - adacosta/mongoid_rails_migrations GitHub Wiki
In migration files, setting
Mongoid.identity_map_enabled = falseat the top of
def self.upwill prevent the migration process from using more and more memory as you iterate over large datasets.
For more information, reference issue 20, created by @barmstrong