Database Reference
In-Depth Information
Chapter 6. Content Management
Systems
In this chapter, we'll look at how you can use MongoDB as a data storage engine for a content
management system (CMS). In particular, we'll examine two main areas of CMS develop-
ment. Our first use case, Metadata and Asset Management , deals with how we can model our
metadata (pages, blog posts, photos, videos) using MongoDB.
Our next use case, Storing Comments , explores several different approaches to storing user
comments in a CMS, along with the trade-offs for each approach.
Metadata and Asset Management
In any kind of a content management system, you need to decide on the basic objects that
the CMS will be managing. For this section, we've chosen to model our CMS on the popular
Drupal CMS. (Drupal does have a MongoDB plug-in, but we've chosen a simpler implement-
ation for the purposes of illustration in this section.) Here, we explore how MongoDB can be
used as a natural data model backend for such a CMS, focusing on the storage of the major
types of content in a CMS.
Solution Overview
To build this system, we'll use MongoDB's flexible schema to store all content “nodes” in
a single collection nodes regardless of type. This guide provides prototype schemas and de-
scribes common operations for the following primary node types:
Basic page
Basic pages are useful for displaying infrequently changing text such as an About page.
With a basic page, the salient information is the title and the content.
Blog post
Blog posts are part of a “stream” of posts from users on the CMS, and store title, author,
content, and date as relevant information.
Search WWH ::




Custom Search