1

I have an existing Rails app that I've put about 100 hours of development into. I would like to push it up to Heroku but I made the mistake of using mongoDB for all of my developmental work. Now I have no schemas or anything of the sort and I'm trying to push out to Heroku and use PostgreSQL. Is there a way I can remove Mongoid and use Postgres? I've tried using DataMapper, but that seems to be doing more harm than good.

3
  • 8
    Why not use MongoDB on Heroku via MongoHQ or MongoLab? Commented Aug 28, 2012 at 4:13
  • 2
    Switching databases (even between relational databases) tends to involve a lot of rewriting, going from MongoDB to PostgreSQL will probably be a bit of a nightmare. Commented Aug 28, 2012 at 4:16
  • @IsaacCambron, that's a good idea. I think I will take that route. Commented Aug 28, 2012 at 13:52

2 Answers 2

1

use postgresql's json data type, transform mongo collections to tables, each table should be the id and doc (json), then its easy to move from one to the other.

Sign up to request clarification or add additional context in comments.

Comments

0

Whether the migration is easy or hard depends on a very large number of things including how many different versions of data structures you have to accommodate. In general you will find it a lot easier if you approach this in stages:

  1. Ensure that all the Mongo data is consistent in structure with your RDBMS model and that the data structure versions are all the same.

  2. Move your data. Expect that problems will be found and you will have to go back to step 1.

The primary problems you can expect are data validation problems because you are moving from a less structured data platform to a more structured one.

Depending on what you are doing regarding MapReduce you may have some work there as well.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.