Database Reference
In-Depth Information
ts : ISODateTime (...),
text : 'Wrong coast!' },
... only last 1 comment listed ...
]
},
{ id : ObjectId (...),
ts : ISODateTime (...),
by : { id : "T4Y...g9" , name : 'Rick' },
circles : [ '10gen' ],
type : 'status' ,
detail : {
text : 'So when do you crush Oracle?' },
comments_shown : 2 ,
comments : [
{ by : { id : "T4Y...AE" , name : 'Max' },
ts : ISODateTime (...),
text : 'Soon... ;-)' },
... only last 2 comments listed ...
]
},
...
]
}
There are a few things to note about this schema:
▪ Each post is listed with an abbreviated number of comments (three might be typical). This
is to keep the size of the document reasonable. If we need to display more comments on a
post, we'd perform a secondary query on the social.post collection for full details.
▪ There are actually multiple social.wall documents for each social.user document,
one wall document per month. This allows the system to keep a “page” of recent posts in
the initial page view, fetching older months if requested.
▪ Once again, the by properties store only the minimal author information for display, help-
ing to keep this document small.
▪ The number of comments on each post is stored to allow later updates to find posts with
more than a certain number of comments since the $size query operator does not allow
inequality comparisons.
Search WWH ::




Custom Search