Tuesday 30 July 2013

Switching between Mongoid and ActiveRecord

I have recently been working on 2 projects, one using Mongoid with MongoDB and one using ActiveRecord with Postgres. Working so closely with the two pretty much alongside each other I have come to the following conclusions:

  • MongoDB should not be used for relational systems. It might seem obvious, but even if the min body of an application is not relational, there are often relational parts to it, and that can really counteract the benefits. Such relations might include user ownership, tagging, etc.
  • I like the declaration of fields within the model - no need to make external schemas.
  • Having said the above, I also like the discipline that creating migrations forces on you. You can really check each change you make to models and refine them, whereas the flexibility of Mongoid can allow indiscipline.
I think that, for the moment, in most projects I would still stick to a RDBMS unless there was an obvious document-style structure to the whole data that could really benefit from MongoDB.

No comments:

Post a Comment