Storing Directory Hierarchy in a Key-Value Data store

前端 未结 4 1418
一个人的身影
一个人的身影 2020-12-12 12:57

What is a clean/efficient method for storing the directory Hierarchy/tree in a Key-Value database (in my case MongoDB but any of them)?

For example a tree structure

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 13:36

    I suggest storing a heap to the the id's of the data items. I think this is the best plan. If you need lots and lots of stuff any heap element could be an index to another heap.

    eg

    { "id:xxx", "id:yyy", "sub-heap-id:zzz"....}

    If this is not clear post a comment and I will explain more when I get home.

提交回复
热议问题