Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding MongoDB (and NoSQL in general) and how to make the best use of it

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?

like image 278
Earlz Avatar asked Apr 04 '10 05:04

Earlz


People also ask

What is the main advantages of MongoDB or NoSQL DBS in general and why are they said to scale better?

When compared to relational databases, NoSQL databases are often more scalable and provide superior performance. In addition, the flexibility and ease of use of their data models can speed development in comparison to the relational model, especially in the cloud computing environment.

What is MongoDB best used for?

MongoDB is built on a scale-out architecture that has become popular with developers of all kinds for developing scalable applications with evolving data schemas. As a document database, MongoDB makes it easy for developers to store structured or unstructured data. It uses a JSON-like format to store documents.

What is it best to use a NoSQL database?

NoSQL databases are often better suited to storing and modeling structured, semi-structured, and unstructured data in one database.

What is NoSQL DB and why we use them?

NoSQL databases store data in documents rather than relational tables. Accordingly, we classify them as "not only SQL" and subdivide them by a variety of flexible data models. Types of NoSQL databases include pure document databases, key-value stores, wide-column databases, and graph databases.


1 Answers

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.

like image 155
Earlz Avatar answered Nov 16 '22 02:11

Earlz