首页 > 数据库技术 > 详细

MongoDB 学习笔记2

时间:2015-10-10 17:20:33      阅读:220      评论:0      收藏:0      [点我收藏+]

文档模型关系

Model One-to-One Relationships with Embedded Documents

Overview

Data in MongoDB has a flexible schema. Collections do not enfoce document structure.

Pattern

In the normalized data model, the address document contains a reference to the patron document.

技术分享
If the address data is frequently retrivevd with name information, then with referencing, your application needs to issue multiple queries to resolve the reference. The better data model would to be embed the address data in the patron data, as in the following document:

技术分享

 

Model One-to-Many Relationships with Embedded Documents


Overview

Pattern

Model one-to-Many Relationships with Document References

Overview

Pattern

MongoDB 学习笔记2

原文:http://www.cnblogs.com/hotbaby/p/4867452.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!