You are viewing an offline version of MongoDB documentation. Some page features might be unavailable. To view the latest version of the page or use interactive features, visit the live page.
Data Model Examples and Patterns
See also:
For additional patterns and use cases, see also: Building with Patterns
The following documents provide overviews of various data modeling patterns and common schema design considerations:
- Document Relationships
Examples for modeling relationships between documents.
- Model One-to-One Relationships with Embedded Documents
- Presents a data model that uses embedded documents to describe one-to-one relationships between connected data.
- Model One-to-Many Relationships with Embedded Documents
- Presents a data model that uses embedded documents to describe one-to-many relationships between connected data.
- Model One-to-Many Relationships with Document References
- Presents a data model that uses references to describe one-to-many relationships between documents.
- Model Tree Structures
Examples for modeling tree structures.
- Model Tree Structures with Parent References
- Presents a data model that organizes documents in a tree-like structure by storing references to "parent" nodes in "child" nodes.
- Model Tree Structures with Child References
- Presents a data model that organizes documents in a tree-like structure by storing references to "child" nodes in "parent" nodes.
See Model Tree Structures for additional examples of data models for tree structures.
- Model Specific Application Contexts
Examples for models for specific application contexts.
- Model Data for Atomic Operations
- Illustrates how embedding fields related to an atomic update within the same document ensures that the fields are in sync.
- Model Data to Support Keyword Search
- Describes one method for supporting keyword search by storing keywords in an array in the same document as the text field. Combined with a multi-key index, this pattern can support application's keyword search operations.