Content Management
Systems and MongoDB
Mitch Pirtle
MongoNY - May 21 2010
New York, NY
One thing real quick, before
we get started.
About this presentation

 Databases from a CMS perspective
 How we got to where we are now
 What MongoDB brings to the equation
 Where we are going
About me
Nothing but web since 1995
Contributor to many FOSS projects (Joomla! founder)
Budding author
  MongoDB for Web Development
  Extreme Joomla! Performance
High-traffic projects (Jetsetter, MTV, Food Networks)
Husband, dad, skate punk, metalcore bassist, coach
Familiar with CMS?
In the beginning...
Purpose of a CMS
Purpose of a CMS

Manage content
Purpose of a CMS

Manage content
Organize navigation
Purpose of a CMS

Manage content
Organize navigation
Dynamic search
Purpose of a CMS

Manage content
Organize navigation
Dynamic search
Self-service management of content
The result?
LAMP
Linux, Apache, MySQL, PHP
Challenges of a CMS
Challenges of a CMS


One size fits all
Challenges of a CMS


One size fits all
Based on ubiquitous platforms
Challenges of a CMS


One size fits all
Based on ubiquitous platforms
Lowest common denominator
Nothing against MySQL,
but...
Nothing against MySQL,
but...
Brittle, inflexible
Nothing against MySQL,
but...
Brittle, inflexible
Difficult for scale
Nothing against MySQL,
but...
Brittle, inflexible
Difficult for scale
Difficult for speed
Nothing against MySQL,
but...
Brittle, inflexible
Difficult for scale
Difficult for speed
Difficult to code with
Nothing against MySQL,
but...
Brittle, inflexible
Difficult for scale
Difficult for speed
Difficult to code with
Lack of relational features pushed relational logic into
applications
Nothing against MySQL,
but...
Brittle, inflexible
Difficult for scale
Difficult for speed
Difficult to code with
Lack of relational features pushed relational logic into
applications
Zero portability as a result
Where that leaves us
Where that leaves us
Everybody ran out and installed without asking
Where that leaves us
Everybody ran out and installed without asking
ISPs happily limited choice
Where that leaves us
Everybody ran out and installed without asking
ISPs happily limited choice
End users and developers obsequiously took LAMP for
granted as the Right Tool for the Right Job™
Where that leaves us
Everybody ran out and installed without asking
ISPs happily limited choice
End users and developers obsequiously took LAMP for
granted as the Right Tool for the Right Job™
Managing content, from a relational database
perspective, SUCKS
Where that leaves us
Everybody ran out and installed without asking
ISPs happily limited choice
End users and developers obsequiously took LAMP for
granted as the Right Tool for the Right Job™
Managing content, from a relational database
perspective, SUCKS
Building CMS apps is not much better either!
Article with comments &
tags

         Tags          Articles       Comments
   id              id               id
   tag             title            date_created
                   slug             author_id
                   excerpt          parent_id
                   author_id        subject
     ArticleTags   date_created     content
   id              date_published
   article_id      date_modified
   tag_id          content
Then the trouble starts
“Hey, can we add social media to our website?”
Websites aren’t just content
Websites aren’t just content

 Interactivity
Websites aren’t just content

 Interactivity
 Rich media
Websites aren’t just content

 Interactivity
 Rich media
 Social media
Websites aren’t just content

 Interactivity
 Rich media
 Social media
 Web services integration
Websites aren’t just content

 Interactivity
 Rich media
 Social media
 Web services integration
 Crazy, whack-daddy scale
Why develop in an
object language, just
to stuff mismatched
chunks of your
objects in a non-
object data store?
“How long can this go on?”
Introducing:
Where that leaves us now
Article with comments, tags,
categories       id
                     Articles

                 title
                 slug
                 excerpt
                 author_id
                 date_created
                 date_published
                 date_modified
                 content
                 comments
                 -- comment1
                 -- comment2
                 -- comment3
                 tags
                 -- tag1
                 -- tag2
                 -- tag3
                 categories
                 -- category1
                 -- category2
                 -- category3
Article with comments, tags,
categories       id
                     Articles

                 title
                 slug
                 excerpt
                 author_id
                 date_created
 Atomic          date_published
                 date_modified
                 content
                 comments
                 -- comment1
                 -- comment2
                 -- comment3
                 tags
                 -- tag1
                 -- tag2
                 -- tag3
                 categories
                 -- category1
                 -- category2
                 -- category3
Article with comments, tags,
categories       id
                     Articles

                 title
                 slug
                 excerpt
                 author_id
                 date_created
 Atomic          date_published
                 date_modified
                 content
 Simple          comments
                 -- comment1
                 -- comment2
                 -- comment3
                 tags
                 -- tag1
                 -- tag2
                 -- tag3
                 categories
                 -- category1
                 -- category2
                 -- category3
Article with comments, tags,
categories       id
                     Articles

                 title
                 slug
                 excerpt
                 author_id
                 date_created
 Atomic          date_published
                 date_modified
                 content
 Simple          comments
                 -- comment1
                 -- comment2
 Fast            -- comment3
                 tags
                 -- tag1
                 -- tag2
                 -- tag3
                 categories
                 -- category1
                 -- category2
                 -- category3
Article with comments, tags,
categories       id
                     Articles

                 title
                 slug
                 excerpt
                 author_id
                 date_created
 Atomic          date_published
                 date_modified
                 content
 Simple          comments
                 -- comment1
                 -- comment2
 Fast            -- comment3
                 tags
                 -- tag1
 Complete        -- tag2
                 -- tag3
                 categories
                 -- category1
                 -- category2
                 -- category3
MySQL
MongoDB
MySQL
MongoDB
MySQL
MongoDB
What I’ve learned
implementing CMS
platforms with MongoDB
under the hood
Lessons learned
Lessons learned

Simplicity of code
Lessons learned

Simplicity of code
Performance
Lessons learned

Simplicity of code
Performance
Simplicity of scale
Lessons learned

Simplicity of code
Performance
Simplicity of scale
Rich media storage
Lessons learned

Simplicity of code
Performance
Simplicity of scale
Rich media storage
Amazing concurrency
Coming to a CMS near you
Drupal for MongoDB
http://drupal.org/project/mongodb

D7: mongodb_cache: Store cache items in mongodb

D7: mongodb_field_storage: Store the fields in mongodb

D7: mongodb_session: Store sessions in mongodb

D6/D7: mongodb_watchdog: Store the watchdog messages in mongodb

D6/D7: mongodb: support library for the other modules

D7: mongodb_block: Store block information in mongodb. Very close to the core
block API

D7: mongodb_queue: DrupalQueueInterface implementation using mongodb

http://sf2010.drupal.org/conference/sessions/mongodb-humongous-drupal
Even MORE Drupal

Work to get listing API into core:
http://drupal.org/node/780154
Experimental goodies to play with:
http://drupalcode.org/viewvc/drupal/contributions/
sandbox/chx/dbtng_mongo_experimental/
Joomla!


MongoDB helper library for Joomla!
(come see me after the talk for access)
Branch of 1.6 development for alternative query builder
Full MongoDB support most likely in 2.0
Not CMS, but still cool.
Ruby & Rails

MongoMapper
http://github.com/jnunemaker/mongomapper/
Brings MongoDB to many RoR platforms
  RadiantCMS
  Typo
  Mephisto
Lithium PHP framework

http://rad-dev.org/lithium/wiki
MongoDB native support
Projects demonstrating MongoDB support:
  http://rad-dev.org/lithium_mongo/source
  http://rad-dev.org/lithium_blog/source
CakePHP framework

MongoDB datasource
http://github.com/ichikaway/mongoDB-Datasource
Example article
http://mark-story.com/posts/view/using-mongodb-
with-cakephp
PHP framework


http://kohanaframework.org/
MangoDB
http://github.com/Wouterrr/MangoDB
MongoDB Language Center
http://www.mongodb.org/display/DOCS/Drivers
Community Resources
http://www.mongodb.org/display/DOCS/
Community
Development Tracker
http://jira.mongodb.org
MongoDB Cookbook
http://cookbook.mongodb.org/
Explore MongoDB @Github
http://github.com/search?q=mongo
Thanks!
Email: spacemonkey@mongodb.org
Skype: mitch.pirtle
Web: http://www.spacemonkeylabs.com
Slides: http://www.slideshare.net/
spacemonkeylabs

Content Management Systems and MongoDB