翻译或纠错本页面
树结构建模¶
MongoDB
- 树结构建模:父文档引用
- Presents a data model that organizes documents in a tree-like structure by storing references to “parent” nodes in “child” nodes.
- 树结构建模: 子文档引用
- Presents a data model that organizes documents in a tree-like structure by storing references to “child” nodes in “parent” nodes.
- 树结构建模: 祖先数组
- Presents a data model that organizes documents in a tree-like structure by storing references to “parent” nodes and an array that stores all ancestors.
- 树结构建模: 物化路径
- Presents a data model that organizes documents in a tree-like structure by storing full relationship paths between documents. In addition to the tree node, each document stores the _id of the nodes ancestors or path as a string.
- 树结构建模: 嵌套集合
- Presents a data model that organizes documents in a tree-like structure using the Nested Sets pattern. This optimizes discovering subtrees at the expense of tree mutability.