MongoDB: benefits of using inline objects

What are the benefits of using inline objects?

In my practice, this is very rare when I do not use inline objects outside my parent. I mean a general example with commentswhich are nested in post_in: I need to show the latest comments in the list of updates, I need to show comments for current_user, etc. So comments cannot be embedded or it will be a pain in the ass.

Thus, there are very few use cases when I need to use inline objects.

The question is, why should I use inline objects even in those rare use cases, what are the benefits of embedding?

+5
source share
1 answer

Embedded objects are a big advantage of any nosql database. Usually embed = read performance + scalability. Take, for example, SO. You can embed answers to questions / answers in a question, answer documents. And that means you don’t need to join comments when you need to display answers / questions. If you don’t need to join, you can move the collection to a separate computer to speed up your application. In sub-resources, a relational database usually becomes a separate table (except for denormalization). And in my practice there are a lot of cases when I need to embed documents.

, , " " . ! ..

nosql : denormalization.

, , , .

current_user

, .

BTW, async, .

, .

+3

All Articles