MongoDB Documentation, Release 3.0.4 Pattern The Child References pattern stores each tree node in a document; in addition to the tree node, document stores in an array the id(s) of the node’s children. Consider the following hierarchy of categories: The following example models the tree using Child References , storing the reference to the node’s children in the field children : db.categories.insert( { _id: "MongoDB", children: [] } ) db.categories.insert( { _id: "dbm", children: [] } ) db.categories.insert( { _id: "Databases", children: [ "MongoDB", "dbm" ] } ) db.categories.insert( { _id: "Languages", children: [] } ) db.categories.insert( { _id: "Programming", children: [ "Databases", "Languages" ] } ) db.categories.insert( { _id: "Books", children: [ "Programming" ] } ) • The query to retrieve the immediate children of a node is fast and straightforward: • You can create an index on the field children to enable fast search by the child nodes: • You can query for a node in the children field to find its parent node as well as its siblings: db.categories.findOne( { _id: "Databases" } ).children db.categories.createIndex( { children: 1 } ) 4.3. Data Model Examples and Patterns 159