TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Best NoSQL methods for Rails

1 点作者 devinrhode2超过 10 年前
Mongoid, Postgres with hstore, Postgres with the JSON data type, CouchDB?

1 comment

bertomartin超过 10 年前
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&#x27;t looked at the rest you mentioned, but I&#x27;ve used the relational aspects of postgres; it&#x27;s a great db, but if you&#x27;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: <a href="https://university.mongodb.com/courses/catalog" rel="nofollow">https:&#x2F;&#x2F;university.mongodb.com&#x2F;courses&#x2F;catalog</a>. 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&#x27;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&#x27;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&#x27;s own document and add a relation. The difference with SQL is that you don&#x27;t do joins in the db, but with Mongoid, you don&#x27;t even see this as the relationships are defined in the models, and they&#x27;re pretty much the same as ActiveRecord. Enjoy.