I need to model a huge binary tree considering:
*Need to know if a node is left child or right child
*The binary tree can grow indefinitely
*Updating structure is not possible, It is only allowed to add a new nodes
*Find specific descendant node by numer and direction (left or right)
*Find last descendant by direction (left or right)
I was reviewing the proposed pattenrs by mongodb:
°Materialized Paths : https://docs.mongodb.com/manual/tutorial/model-tree-structures-with-materialized-paths/
°Child References: https://docs.mongodb.com/manual/tutorial/model-tree-structures-with-child-references/
I was thinking for my case is better use Materialized Paths but I was worried about the storage of the path because of its lenght (grow indefinitely). In the other hand there is Child References pattern, it is good but I was worried about finding the whole path of a node talking about the performance of the traversal operation.
Thats it, which one would you recommendme?, What other ways do you think there are to model this situation?.
Thanks
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…