Database Manual / Data Modeling / Data Model Examples and Patterns

Document Relationships文档关系

MongoDB's flexible data model gives you multiple options to map relationships between different entities in your schema.MongoDB灵活的数据模型为您提供了多种选项来映射模式中不同实体之间的关系。

Generally, your choice of data model depends on whether you want to embed related data in the same collection or use references to connect related data that exists in separate collections. 通常,您对数据模型的选择取决于您是想将相关数据嵌入到同一集合中,还是使用引用来连接存在于单独集合中的相关数据。Before you choose a relationship pattern, review Embedded Data Versus References to understand the advantages of each approach.在选择关系模式之前,请查看嵌入式数据与引用的对比,以了解每种方法的优点。

Get Started开始使用

These pages show examples of different data relationships and how to apply them in a MongoDB schema:这些页面显示了不同数据关系的示例以及如何在MongoDB模式中应用它们: