N
N
nickerlan2019-06-21 12:49:20
MongoDB
nickerlan, 2019-06-21 12:49:20

Is Mongo optimized out of the box?

I choose which data structure to choose.
There is a "Users" document.
Each user has a "Chat" where there can be many messages. Messages do not always need to be displayed.
Should the chat be stored in one of the fields of the "user" object?
When I make selections for users that don't include this field, won't monge need to cut kilometer-long sheets?
As an alternative - there is an approach closer to what I remember from the time of SQL - to make a separate document from chats or even individual messages, which are then collected into a chat.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Shumov, 2019-06-21
@nickerlan

Regardless of the sql or nosql solution, it is still necessary not to forget that no one canceled normalization. It is better to store both users and chats and messages separately

I
index0h, 2019-06-21
@index0h

How is it better?

Better take MySQL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question