开发者

mongodb: storing a hierarchical tree structure?

开发者 https://www.devze.com 2023-03-14 16:10 出处:网络
on the mongodb, how would I go about storing a hierarchical tree data in which each node contains a Java object containing it\'s own set of string variables and objects?

on the mongodb, how would I go about storing a hierarchical tree data in which each node contains a Java object containing it's own set of string variables and objects?

If there were no children, it would straight forward. but how would you store a child node DBobject as a field on the mongodb?

for example on a Jtree, if a user clicks and selects delete on a specific node, there should be some unique identi开发者_运维百科fier that would correspond.

p.s. can I create a database for each user and let mongodb authenticate the user?


Kim, You should check out this mongodb article Trees in mongodb. It might give you some lead.


The document model is JSon so that is a tree structure in itself. You also have option of embedded (arbitrary) links between docs; naturally you can compose a directed graph of documents linking to one another.

0

精彩评论

暂无评论...
验证码 换一张
取 消