Trees in CouchDB

I am new to CouchDB and wondering.

I save posts with the parent id of the message as an attribute. A message can also have childMessage as its parent, so it looks like a tree.

How can I query all children, including children of children?

thank

+3
source share
2 answers

This is a widely used method when working with hierarchical data: http://probablyprogramming.com/2008/07/04/storing-hierarchical-data-in-couchdb/

+3
source

CouchDB - . . , ?

:.

{
  "msg":"Parent message",
  "children":[
    {
       "msg":"sub message 1"
    },
    {
       "msg":"sub message 2",
       "children":[
         {
           "msg":"sub sub message 1"
         }
       ]
    }
  ]
}
-1

Source: https://habr.com/ru/post/1781716/


All Articles