well that was just an idea.. each "doc" is the list of it's direct children (and does not contain it's own node data). + one special doc about the root, if needed. i guess may be unusable in most cases.
by dicts i meant same like lists but having node-id as key. http://en.wikipedia.org/wiki/Nested_set_model http://en.wikipedia.org/wiki/Tree_traversal https://communities.bmc.com/communities/docs/DOC-9902 svil On Fri, 22 Feb 2013 18:14:49 +1300 Michael Heuberger <[email protected]> wrote: > thanks andrey and svil > > depth is infinite. in theory a message can have million replies forth > and back. similar like a very long email thread. > > i think storing ancestors à la andrey would be too much hassle but > works well for few levels. > > svil, what did you mean with dicts and with keeping all children in > one doc? can you tell me more? > > thanks, > michael > > On 22/02/13 17:27, svilen wrote: > > my rough guess: > > > > if it's finite depth, then all in one doc: > > - list of (item or (list of ...)) > > - or same with dicts > > > > else, one doc per message keeping just link-to-parent, > > or multiple links-to-grand...grand-parents and/or root. > > similar to the strategies in SQL - nested etc. > > keeping all chidlren of same node in one doc is also possible.. > > > > in any case either traversal or storing or both will be > > difficult. > > > > ciao > > svil > > > > On Fri, 22 Feb 2013 17:13:01 +1300 > > Michael Heuberger <[email protected]> wrote: > > > >> Hello guys > >> > >> I'd like to store messages in a tree like structure. Whenever you > >> reply to a message, then the original message becomes the parent > >> message. > >> > >> How would you implement something like this in CouchDB? Just > >> curious and need a little guidance + advice here. > >> > >> Thanks, > >> Michael > >> > >> -- > >> > >> Binary Kitchen > >> Michael Heuberger > >> 4c Dunbar Road > >> Mt Eden > >> Auckland 1024 > >> (New Zealand) > >> > >> Mobile (text only) ... +64 21 261 89 81 > >> Email ................ [email protected] > >> Website .............. http://www.binarykitchen.com > >> > > -- > > Binary Kitchen > Michael Heuberger > 4c Dunbar Road > Mt Eden > Auckland 1024 > (New Zealand) > > Mobile (text only) ... +64 21 261 89 81 > Email ................ [email protected] > Website .............. http://www.binarykitchen.com >
