From ActiveRecord to MongoMapper

47 views
Skip to first unread message

Cris Shupp

unread,
Jul 16, 2014, 3:52:21 PM7/16/14
to mongo...@googlegroups.com
I will apologize in advance for what must be a question asked hundreds of times before, and, if so, show a real lack of google skills....

I have an existing Rail 4.0 app that has used JRuby, Oracle and ActiveRecord.  Are there any tutorials out there that cover how to convert existing models into MongoMapper::Document models?

Thanks,

Cris

Jon Kern

unread,
Jul 16, 2014, 9:37:32 PM7/16/14
to mongo...@googlegroups.com
First time i saw a question like this…


A mongomapper class is like "butta."


You’ll likely need to brush up on the world of NoSQL?

Some classic SQL joins could be replaced as embedded. But a lot depends on… well, it just depends. Read.

Do a quick dummy project with a model or two that look a lot like your AR models… use the generator, use the scaffold stuff, just to get your feet wet and see how easy it is.

FWIW: Another popular ORM is Mongoid… Might be more tutorials and hand-holding over there.

Write down your experience and your steps, you may be the one who posts the first tutorial on the subject :-)

You may have to do a data migration, and do indexes to match your usages, etc. For the migration, nothing says you can’t have one model class associated to the Oracle & AR method, and the new model associated to the Mongo Database. And invoke the “create” on the mongo class seeding it with inform from your oracle record. Lots of details left out, esp around join tables ;-)

--
You received this message because you are subscribed to the Google
Groups "MongoMapper" group.
For more options, visit this group at
http://groups.google.com/group/mongomapper?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "MongoMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongomapper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Dossey

unread,
Jul 16, 2014, 10:04:40 PM7/16/14
to mongo...@googlegroups.com
I converted an app from ActiveRecord to MongoMapper a while back.  A straight conversion of a simple dataset is relatively easy, but if you do that, you miss out on a lot of what MongoDB can offer.  It will take practice to gain understanding of data modeling patterns that are a better fit for MongoDB.  

Justin Dossey


--
Reply all
Reply to author
Forward
0 new messages