引用文档看的不是太懂,你能写个例子我看下码?
我的意思就是使用mongodb的时候,尽量使用nested docment(嵌套文档),不要使用关系型数据库中的主外健关联的机制。
上面的文章中这句话看到了吗?
It turns out that most of the time where you find yourself with a Master-Detail pattern in an RDBMS, you can achieve the same level of consistency in MongoDB by modelling your object as a rich, nested document, rather than multiple joined tables. Combine this with MongoDB’s atomic update operators, and you can solve most of what you would traditionally do with multi-statement transactions in an RDBMS.
|