KJW
KJW

Reputation: 15251

mongodb: storing a hierarchical tree structure?

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 identifier that would correspond.

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

Upvotes: 4

Views: 5219

Answers (2)

RameshVel
RameshVel

Reputation: 65867

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

Upvotes: 4

alphazero
alphazero

Reputation: 27234

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.

Upvotes: 1

Related Questions