Database Reference
In-Depth Information
Photo
Photos participate in photo galleries, and store title, description, author, and date along
with the actual photo binary data.
Note that each type of node may participate in groups of nodes. In particular, a basic page
would be part of a folder on the site, a blog post would be part of a blog , and a photo would
be part of a gallery . This section won't go into details about how we might group these nodes
together, nor will it address navigational structure.
Schema Design
Although documents in the nodes collection contain content of different types, all documents
have a similar structure and a set of common fields. Consider the following prototype docu-
ment for a “basic page” node type:
{ _id : ObjectId (...)),
metadata : {
nonce : ObjectId (...),
type : 'basic-page'
parent_id : ObjectId (...),
slug : 'about' ,
title : 'About Us' ,
created : ISODate (...),
author : { _id : ObjectId ( ), name : 'Rick' },
tags : [ ... ],
detail : { text : '# About Us\n...' }
}
}
Most fields are descriptively titled. The parent_id field identifies groupings of items, as in a
photo gallery, or a particular blog. The slug field holds a URL-friendly unique representation
of the node, usually that is unique within its section for generating URLs.
Alldocumentsalsohavea detail fieldthatvarieswiththedocumenttype.Forthebasicpage,
the detail field might hold the text of the page. For a blog entry, the detail field might hold a
subdocument. Consider the following prototype for a blog entry:
{ ...
metadata : {
Search WWH ::




Custom Search