一对很少
一个人的地址为例,这时候使用内嵌文档是很合适,可以在person文档中嵌入数组地址文档:
< db.person.findOne()
{
name: ‘Kate Monster’,
ssn:...< db.parts.findOne()
{
_id : ObjectID(‘AAAA’),
partno : ’123-aff-456′,
name : ‘#4 grommet’,
qty: 94,...cost: 0.94,
price: 3.99
}
< db.products.findOne()
{
name : ‘left-handed smoke shifter’,
manufacturer...< db.hosts.findOne()
{
_id : ObjectID(‘AAAB’),
name : ‘goofy.example.com’,
ipaddr : ’127.66.66.66′
}...<db.logmsg.findOne()
{
time : ISODate(“2014-03-28T09:42:41.382Z”),
message : ‘cpu is on fire!’