S
S
Sport-code2019-11-23 08:27:38
MongoDB
Sport-code, 2019-11-23 08:27:38

What is the correct way to store a tree in MongoDB?

Hello!
Please tell me, I am writing a React application with a structure,
how to save the user tree (structure)
if the user tree grows (5000, 10000, ...)?
I use this component
1. Save the entire structure for each user (it won’t be cumbersome)
2. Save the user ID under whom he registered and recurse to form a tree (structure) of the team
3. Or something else ...
Thanks for earlier.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
index0h, 2019-11-23
@Sport-code

Each element of the tree is a separate document in the collection with a link to the parent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question