anlek / mongify

Mongify allows you to map your data from a sql database and into a mongodb document database.
http://github.com/anlek/mongify
MIT License
318 stars 82 forks source link

Test Mode or Limit on Number of Records? #42

Closed mikebronner closed 10 years ago

mikebronner commented 10 years ago

Hi, we have a fairly large database to convert from MySQL to MongoDB. This looks like the best tool I've come across so far for performing the conversion process.

Is there a way to limit the number of records to convert, so that we can test the conversion results before running all our 3+ million records?

Thanks!

anlek commented 10 years ago

There is no real way to limit the number of records. In the next week I will allow you to do a before_save and set row to nil to prevent it from being writing into MongoDB, so you might be able to do something like this:

table "users" do
  before_save do |row|
    row = nil if row["id"] >= 30 #assuming your ids start from 1
  end
end
mikebronner commented 10 years ago

I would need a way to limit the query on the mysql side of things, as we can't be pulling down 3GB of data each time we run a conversion test. I guess I would have to set up a test database with a subset of records to work off of. Thanks for the pointer, though. :)

anlek commented 10 years ago

Yes, a test database (with limited data) would be much smarter! ;) Let me know if you have any other issues.