<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> MongoDB中的数据是非常灵活的,集合中也不强制文档要采用统一的结构。但是认真考虑数据模型依然是非常重要的,因为这会影响到应用程序性能和数据库的能力。本文讲述了MongoDB中常见的一对一、一对多关系模型如如何建模。</p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> <a href="http://www.linuxidc.com/topicnews.aspx?tid=14" rel="noopener noreferrer" style="color:rgb(179,43,213)" target="_blank" title="CentOS">CentOS</a>编译安装MongoDB <a href="http://www.linuxidc.com/Linux/2012-02/53834.htm" rel="noopener noreferrer" style="color:rgb(179,43,213)" target="_blank">http://www.linuxidc.com/Linux/2012-02/53834.htm</a></p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> CentOS 编译安装 MongoDB与mongoDB的php扩展 <a href="http://www.linuxidc.com/Linux/2012-02/53833.htm" rel="noopener noreferrer" style="color:rgb(179,43,213)" target="_blank">http://www.linuxidc.com/Linux/2012-02/53833.htm</a></p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> CentOS 6 使用 yum 安装MongoDB及服务器端配置 <a href="http://www.linuxidc.com/Linux/2012-08/68196.htm" rel="noopener noreferrer" style="color:rgb(179,43,213)" target="_blank">http://www.linuxidc.com/Linux/2012-08/68196.htm</a></p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> <a href="http://www.linuxidc.com/topicnews.aspx?tid=2" rel="noopener noreferrer" style="color:rgb(179,43,213)" target="_blank" title="Ubuntu">Ubuntu</a> 13.04下安装MongoDB2.4.3 <a href="http://www.linuxidc.com/Linux/2013-05/84227.htm" rel="noopener noreferrer" style="color:rgb(179,43,213)" target="_blank">http://www.linuxidc.com/Linux/2013-05/84227.htm</a></p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> MongoDB入门必读(概念与实战并重) <a href="http://www.linuxidc.com/Linux/2013-07/87105.htm" rel="noopener noreferrer" style="color:rgb(179,43,213)" target="_blank">http://www.linuxidc.com/Linux/2013-07/87105.htm</a></p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> 《MongoDB 权威指南》(MongoDB: The Definitive Guide)英文文字版[PDF] <a href="http://www.linuxidc.com/Linux/2012-07/66735.htm" rel="noopener noreferrer" style="color:rgb(179,43,213)" target="_blank">http://www.linuxidc.com/Linux/2012-07/66735.htm</a></p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> (1)一对一嵌入式文档模型(Embedded Document Model)</p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> 假设赞助商和住址是一种一对一关系,赞助商只有一处住址。赞助商可以看成是住址的属性或字段,住址也可以看成是赞助商的一个属性或字段。在类似于这种关系中,使用嵌入式数据模型(Embedded)的好处就是在一次查询中就能得到想要的全部数据,而引用性模型(References)则需要多次查询才能得到想要的数据(姓名和住址)。</p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> 赞助商和住址之间的关系(References)</p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> {<!-- --></p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> _id: "joe",</p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> name: "Joe Bookreader"</p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> }</p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> {<!-- --></p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:rgb(250,250,252)"> patron_id: "joe",</p>
<p style="color:rgb(51,51,51); font-family:tahoma,宋体; font-size:14px; line-height:22.3999996185303px; text-align:justify; background-color:r |
|