Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7539539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:24:32+00:00 2026-05-30T07:24:32+00:00

I want to run a data transformation / migration for MongoDB. I found the

  • 0

I want to run a data transformation / migration for MongoDB. I found the mongo_mapper_ext gem on stackoverflow, but I guess I’m so new to migrations in general that I’m not sure how to use it.

My Rails app is deployed on heroku. So I think once I write the migration and push it to heroku, I should be able to run heroku rake:db migrate. Is that correct, or should that migration be run in an application initializer?

When I write the migration itself, where does that file go in my app directory?

https://github.com/alexeypetrushin/mongo_mapper_ext

Any advice on the best way to do this would be so helpful. Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:24:34+00:00Added an answer on May 30, 2026 at 7:24 am

    if you look at mongo_mapper_ext’s rake task, it looks like you would put the migrations file(s) in the db directory under your rails application.

    namespace :db do
      desc "Migrate Database"
      task migrate: :environment do
        ::Migration = MongoMapper::Migration
        Dir["#{rad.config.runtime_dir!}/db/**/*.rb"].each{|f| require f.sub(/\.rb$/, '')}
    
        database_alias = ENV['d'] || ENV['database']
        database_alias = 'default' if database_alias.blank?
    
        version = ENV['v'] || ENV['version']
        if version.blank?
          size = MongoMapper::Migration.definitions[database_alias].size
          highest_defined_version = size == 0 ? 0 : size - 1      
          version = highest_defined_version
        else
          version = version.to_i
        end
    
        MongoMapper::Migration.update database_alias, version
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run following html/JS code in PhoneGap, but the alert dialog is
I am using the Business Objects Data Integrator tool and I want to run
I want to run DBCC CHECKIDENT on a SqlCe4 database but it wont let
I want to run a shell command in my c program. But the thing
I used the matlab neural network to train on some data but I want
I want to run a mysql query where I get all data from rows
I want to run split() in a for loop, but when I pass it
I want run a script as follows: runner: ssh 'java program &' ssh 'java
Why this code don't work,when i want run this code vwd 2008 express show
I want to run a weekly batch process in an asp.net page. How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.