Model Tree Structures with Parent References

Overview

A tree-alike data model structure in mongo storing references to “parent”nodes in the child nodes.

Pattern

The Parent Reference pattern stores each tree node in a document; in addition to the tree, the document stores the id of the node’s parent.

Consider the following hierarchy of categories:

MongoDB 树形模型

The following example models the tree using Parent

Reference, storing the reference to the parent category in the field parent:

相关文章:

  • 2022-01-09
  • 2021-08-29
  • 2021-12-08
  • 2022-12-23
  • 2021-12-30
  • 2021-11-11
  • 2021-10-24
猜你喜欢
  • 2022-02-14
  • 2021-12-09
  • 2022-01-13
  • 2022-02-26
  • 2022-12-23
  • 2021-06-13
  • 2021-12-07
相关资源
相似解决方案