

Ask HN: Best NoSQL methods for Rails - devinrhode2

Mongoid, Postgres with hstore, Postgres with the JSON data type, CouchDB?
======
bertomartin
Recently investigating this myself. Mongoid is an Rails ODM for MongoDB. It
seems like a nice one to start with as the interface is very close to
ActiveRecord. I haven't looked at the rest you mentioned, but I've used the
relational aspects of postgres; it's a great db, but if you're thinking about
going NoSQL, why not go the whole way? Many serious companies are using these
technologies for their businesses, and they seem to have matured over the past
few years. A good place to get more information on MongoDB is:
[https://university.mongodb.com/courses/catalog](https://university.mongodb.com/courses/catalog).
BTW, one thing to be careful of when working with nosql is that you still need
to model your data and you can definitely model relationships (just that they
usually don't support joins at the db level). So, you could go through pretty
much the same steps that you would when modeling data for a SQL db, but in the
nosql case, it's easier to change the schema as you go. So you can imagine an
Author entity, with a bunch of Book entities embedded in a single document
(MongoDB or other document oriented stores). If later, you wanna add Book to
another document, then you can separate Book into it's own document and add a
relation. The difference with SQL is that you don't do joins in the db, but
with Mongoid, you don't even see this as the relationships are defined in the
models, and they're pretty much the same as ActiveRecord. Enjoy.

