V
V
Vasily Vasilyev2021-04-12 10:57:45
MongoDB
Vasily Vasilyev, 2021-04-12 10:57:45

MongoDB best practices. What is more practical - nesting or table relationships?

There is a table of objects, each object has properties with several levels of nesting. There are many properties (now 30+), and their number will increase over time. Plus, you need to implement user roles (if the object was not created by you, you can't go there).
How would it be better to implement the database structure - a lot of different logically structured tables with links to related tables by object id or one large table with nested subdocuments?

I have been dealing with database structures for 2 weeks, I ask you not to throw slippers if the question is obvious.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2021-04-12
@Basil_Dev

If you need linked tables then why choose MongoDB over any SQL option?
Practicality is better measured by performance tests, and in this case everything is too general - the scope and type of properties is unknown, there are no tables in mongo as such, there are collections.
The number of objects is unknown.
If the volume of the database is planned to be small (up to a couple of gigabytes), then in principle it does not matter.

R
Romses Panagiotis, 2021-04-12
@romesses

How would it be better to implement the database structure - a lot of different logically structured tables with links to related tables by object id or one large table with nested subdocuments?
Documents should be self-contained and without references to other documents.
In theory, the 2nd option seems native to Monga.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question