D
D
Daniil Kolesnichenko2015-07-01 05:44:13
Database
Daniil Kolesnichenko, 2015-07-01 05:44:13

What is better to use for tree data structure?

It is necessary to make a database with categories and products, and categories can be nested into each other and products can be in the same category with other categories. Are relational databases suitable for this task? Or is it better to take something like Mongo (it seems to me that it is much easier to describe what I need in BSON)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
matperez, 2015-07-01
@matperez

The relational basis approaches. You can use nested sets or materialized path. Read about both solutions. For both, most likely there are ready-made implementations in the language you use.
Tree structures are indeed easier to describe in Mongo, but harder to keep up to date.
I would take what is more familiar and for which it is easier for you personally to find good specialists.

R
Roman Mirilaczvili, 2015-07-01
@2ord

It is better to avoid strong nesting of categories. When working with relational databases, you will have to compose complex queries with join.
If there are many relationships between entities, then sometimes it is worth trying out a solution with graph databases.
When is a graph database suitable
Well, in general, Mongo is probably not suitable for the task.
Types of NoSQL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question