13

I am beginning to think that my next project I am wanting to do would work better with a NoSQL solution. The project would either involve a ton of 2-column tables or a ton of dynamic queries with dynamically generated columns in a traditional SQL database. So I feel a NoSQL database would be much cleaner.

I'm looking at MongoDB and it looks pretty promising. Anyway, I'm attempting to make sense of it all. Also, I will be using MongoMapper in Ruby.

Anyway though, I'm confused as to how to layout things in such a freeform database. I've read NoSQL best practices and the answer there says that normalization is usually bad in a NoSQL DB. So how would be the best way of laying out say a simple blog with users, posts, and comments?

My natural thought was to have three collections for each and then link them by a unique ID. But this apparently is wrong? So, what are some of the ways to lay out such a thing? My concern with the answer given in the other question is, what if the author's name changed? You'd have to go through updating a ton of posts and comments. But is this an okay thing to do with NoSQL?

Community
  • 1
  • 1
Earlz
  • 62,085
  • 98
  • 303
  • 499

2 Answers2

6

Ok, I've found two pages that are helpful Schema Design and Data Modeling (a full application in RoR)

Also, the #mongodb channel on IRC is extremely helpful. The user dacort there helped me to find those very useful pages.

Earlz
  • 62,085
  • 98
  • 303
  • 499
3

Here an explanation of the use of DBRefs in MongoDB: http://valyagolev.net/article/mongo_dbref/

tuinstoel
  • 7,248
  • 27
  • 27