SlideShare a Scribd company logo
Consulting Engineer, 10gen
Jason Zucchetto
https://twitter.com/mongodb
MongoDB for Content
Management
Agenda
• MongoDB Features and Overview
• Sample Content Management System (CMS)
Application
• Schema Design Considerations
• Building Feeds and Querying Data
• Replication, Failover, and Scaling
• Case Studies
• Further Resources
MongoDB Features
• JSON Document Model with
Dynamic Schemas
• Auto-Sharding for Horizontal
Scalability
• Text Search
• Aggregation Framework and
MapReduce
• Full, Flexible Index Support
and Rich Queries
• Built-In Replication for High
Availability
• Advanced Security
• Large Media Storage with
GridFS
Sample CMS
Application
CMS Application Overview
• Business news service
• Hundreds of stories per day
• Millions of website visitors per month
• Comments
• Related stories
• Tags
• Company profiles
Viewing Stories (Web Site)
Headline
Date, Byline
Copy
Comments
Tags
Related Stories
Viewing Categories/Tags (Web
Site)
Headline
Date, Byline
Lead Text
Headline
Date, Byline
Lead Text
Sample Article
Headline
Byline, Date, Comments
Copy
Related Stories
Image
Schema Design
Considerations
Sample Relational DB Structure
story
id
headline
copy
authorid
slug
…
author
id
first_name
last_name
title
…
tag
id
name
…
comment
Id
storyid
name
Email
comment_text
…
related_story
id
storyid
related_storyid
…
link_story_tag
Id
storyid
tagid
…
Sample Relational DB Structure
• Number of queries per page load?
• Caching layers add complexity
• Tables may grow to millions of rows
• Joins will become slower over time as db
increases in size
• Schema changes
• Scaling database to handle more reads
MongoDB Schema Design
• “Dynamic Schema”, however, schema design is
important
• JSON documents
• Design for the use case and work backwards
• Avoid a relational model in MongoDB
• No joins or transactions, most related information
should be contained in the same document
• Atomic updates on documents, equivalent of
transaction
{
_id: 375,
headline: ”Apple Reports Second Quarter Earnings",
date: ISODate("2012-07-14T01:00:00+01:00"),
url: “apple-reports-second-quarter-earnings”,
byline: {
author: “Jason Zucchetto”,
title: “Lead Business Editor”
},
copy: “Apple reported second quarter revenue today…”,
tags: [
”AAPL",
”Earnings”
],
comments: [
{ name: “Frank”, comment: “Great story!”}
]
}
Sample MongoDB Schema
{
_id: 375,
headline: ”Apple Reports Second Quarter Earnings",
date: ISODate("2012-07-14T01:00:00+01:00"),
url: “apple-reports-second-quarter-earnings”,
byline: {
author: “Jason Zucchetto”,
title: “Lead Business Editor”
},
copy: “Apple reported second quarter revenue today…”,
tags: [
”AAPL",
”Earnings”
],
image: “/images/aapl/tim-cook.jpg”,
ticker: “AAPL”
}
Adding Fields Based on
Story
{
_id: 375,
headline: ”Apple Reports Second Quarter Earnings",
date: ISODate("2012-07-14T01:00:00+01:00"),
url: “apple-reports-second-quarter-earnings”,
…
copy: “Apple reported second quarter revenue today…”,
tags: [
”AAPL",
”Earnings”
],
last25comments: [
{ name: “Frank”, comment: “Great story!”},
{ name: “John”, comment: “This is interesting”}
…
]
}
High Comment Volume
{
_id: 375,
headline: ”Apple Reports Second Quarter Earnings",
date: ISODate("2012-07-14T01:00:00+01:00"),
url: “apple-reports-second-quarter-earnings”,
…
relatedstories: [
{
headline: “Google Reports on Revenue”,
date: ISODate("2012-07-15T01:00:00+01:00"),
slug: “goog-revenue-third-quarter”
}, {
headline: “Yahoo Reports on Revenue”,
date: ISODate("2012-07-15T01:00:00+01:00"),
slug: “yhoo-revenue-third-quarter”
}
]
}
Managing Related Stories
{ // Story Collection (sample document)
_id: 375,
headline: ”Apple Reports Second Quarter Earnings",
date: ISODate("2012-07-14T01:00:00+01:00"),
url: “apple-reports-second-quarter-earnings”,
byline: {
author: “Jason Zucchetto”,
title: “Lead Business Editor”
},
copy: “Apple reported second quarter revenue today…”,
tags: [
”AAPL",
”Earnings”
],
last25comments: [
{ name: “Frank”, comment: “Great story!”},
{ name: “John”, comment: “This is interesting”}
]
Full Sample Story Schema
image: “/images/aapl/tim-cook.jpg”,
ticker: “AAPL”,
relatedstories: [
{
headline: “Google Reports on Revenue”,
date: ISODate("2012-07-15T01:00:00+01:00"),
slug: “goog-revenue-third-quarter”
}, {
headline: “Yahoo Reports on Revenue”,
date: ISODate("2012-07-15T01:00:00+01:00"),
slug: “yhoo-revenue-third-quarter”
}
]
}
Full Sample Story Schema
story
{
headline
date
url
…
relatedstories : []
last25comments : []
…
companyid
}
CMS Collections
comment
{
story_id
name
comment
}
company
{
name
url
location
ticker
last25stories : []
}
Querying and Indexing
// Display a story, related stories, and first page of comments
db.story.find( { url: “apple-reports-second-quarter-earnings” });
// Display a story, related stories, and second page of comments
db.story.find( { url: “apple-reports-second-quarter-earnings” });
db.comment.find( { story_id : 1234 }).limit(25).skip(25).sort({ date
: -1 });
// All Stories for a given tag
db.story.find( { tags: “Earnings” });
Querying MongoDB
// Display data for a company, latest stories
db.company.find( { url: “apple-inc” });
// Display data for a company, all stories
db.company.find( { url: “apple-inc” });
db.story.find( { company_id : 1234 });
Querying MongoDB
// Inserting new stories are easy, just submit JSON document
db.story.insert( { headline: “Apple Reports Revenue”... });
// Adding story tags
db.story.update( { _id : 375 }, { $addToSet : { tags : "AAPL" } }
)
// Adding a comment (if embedding comments in story)
db.story.update( { _id : 375 }, { $push: { comments: { name:
„Jason‟, „comment: „Great Story‟} } } )
Inserting and Updating
Stories
// Index on story slug
db.story.ensureIndex( { url: 1 });
// Index on story tags
db.story.ensureIndex( { tags: 1 });
MongoDB Indexes for CMS
Building Custom RSS
Feeds
// Very simple to gather specific information for a feed
db.story.find( { tags: { $in : [“Earnings”, “AAPL”] } }).sort(
{ date : -1 });
Query Tags and Sort by Date
Replication, Failover, and
Scaling
Replication
• Extremely easy to set up
• Replica node can trail primary node and
maintain a copy of the primary database
• Useful for disaster
recovery, failover, backups, and specific
workloads such as analytics
• When Primary goes down, a Secondary will
automatically become the new Primary
Replication
Reading from Secondaries (Delayed
Consistency)
Reading from Secondaries (Delayed
Consistency)
Scaling Horizontally
• Important to keep working data set in RAM
• When working data set exceeds RAM, easy to
add additional machines and segment data
across machines (sharding)
Sharding with MongoDB
Case Studies
Runs unified data store serving hundreds of
diverse web properties on MongoDB
Case Study
Problem Why MongoDB Results
• Hundreds of diverse
web properties built on
Java-based CMS
• Rich documents forced
into ill-suited model
• Adding new data
types, tables to RDBMS
killed read performance
• Flexible schema
• Rich querying and support
for secondary index
support
• Easy to manage
replication and scaling
• Developers can focus on
end-user features instead
of back-end storage
• Simplified day-to-day
operations
• Simple to add new
brands, content types, etc.
to platform
Serves targeted content to users using MongoDB-
powered identity system
Case Study
Problem Why MongoDB Results
• 20M+ unique visitors
per month
• Rigid relational schema
unable to evolve with
changing data types
and new features
• Slow development
cycles
• Easy-to-manage
dynamic data model
enables limitless
growth, interactive
content
• Support for ad hoc
queries
• Highly extensible
• Rapid rollout of new
features
• Customized, social
conversations
throughout site
• Tracks user data to
increase
engagement, revenue
Powers content-serving web platform on MongoDB
to deliver dynamic data to users
Case Study
Problem Why MongoDB Results
• Static web content
• Siloed data
stores, disparate
technologies
• Unable to aggregate
and integrate data for
dynamic content
• Support for agile
development
• Easy to use and
maintain
• Low subscription and
HW costs
• Ability to serve dynamic
content
• Decreased TCO
• Replaced multiple
technologies with single
MongoDB database
Resource Location
MongoDB Downloads 10gen.com/download
Free Online Training education.10gen.com
Webinars and Events 10gen.com/events
White Papers 10gen.com/white-papers
Case Studies 10gen.com/customers
Presentations 10gen.com/presentations
Documentation docs.mongodb.org
Additional Info info@10gen.com
For More Information
Resource Location
Consulting Engineer, 10gen
Jason Zucchetto
https://twitter.com/mongodb
Thank You

More Related Content

PPTX
Webinar: MongoDB for Content Management
POTX
Content Management with MongoDB by Mark Helmstetter
KEY
Content Mangement Systems and MongoDB
PPTX
MongoDB Evenings DC: MongoDB - The New Default Database for Giant Ideas
PPTX
The Right (and Wrong) Use Cases for MongoDB
PDF
Key note big data analytics ecosystem strategy
PPTX
MongoDB and Hadoop: Driving Business Insights
PDF
IBM Connect 2014 - AD205: Creating State-of-the-Art Web Applications with Dom...
Webinar: MongoDB for Content Management
Content Management with MongoDB by Mark Helmstetter
Content Mangement Systems and MongoDB
MongoDB Evenings DC: MongoDB - The New Default Database for Giant Ideas
The Right (and Wrong) Use Cases for MongoDB
Key note big data analytics ecosystem strategy
MongoDB and Hadoop: Driving Business Insights
IBM Connect 2014 - AD205: Creating State-of-the-Art Web Applications with Dom...

What's hot (20)

PDF
MongoDB .local Munich 2019: MongoDB Atlas Auto-Scaling
PPTX
MongoDB et Hadoop
PPTX
Webinar: Elevate Your Enterprise Architecture with In-Memory Computing
PDF
Blazing Fast Analytics with MongoDB & Spark
PPTX
Calculating ROI with Innovative eCommerce Platforms
PDF
MongoDB .local Munich 2019: Managing a Heterogeneous Stack with MongoDB & SQL
PPTX
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
PPTX
Webinar: MongoDB and Analytics: Building Solutions with the MongoDB BI Connector
PDF
Spark and MongoDB
PPTX
MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...
PPTX
L’architettura di Classe Enterprise di Nuova Generazione
PPTX
How Insurance Companies Use MongoDB
PPTX
Building an unstructured data management solution with elastic search and ama...
PPTX
MongoDB Days Silicon Valley: Jumpstart: The Right and Wrong Use Cases for Mon...
PPTX
Common MongoDB Use Cases
PPT
BP204 - Take a REST and put your data to work with APIs!
PPTX
MongoDB & Hadoop - Understanding Your Big Data
PPTX
Share Point2007 Best Practices Final
PDF
MongoDB .local Chicago 2019: Using MongoDB Transactions to Implement Cryptogr...
PPTX
Query in Couchbase. N1QL: SQL for JSON
MongoDB .local Munich 2019: MongoDB Atlas Auto-Scaling
MongoDB et Hadoop
Webinar: Elevate Your Enterprise Architecture with In-Memory Computing
Blazing Fast Analytics with MongoDB & Spark
Calculating ROI with Innovative eCommerce Platforms
MongoDB .local Munich 2019: Managing a Heterogeneous Stack with MongoDB & SQL
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
Webinar: MongoDB and Analytics: Building Solutions with the MongoDB BI Connector
Spark and MongoDB
MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...
L’architettura di Classe Enterprise di Nuova Generazione
How Insurance Companies Use MongoDB
Building an unstructured data management solution with elastic search and ama...
MongoDB Days Silicon Valley: Jumpstart: The Right and Wrong Use Cases for Mon...
Common MongoDB Use Cases
BP204 - Take a REST and put your data to work with APIs!
MongoDB & Hadoop - Understanding Your Big Data
Share Point2007 Best Practices Final
MongoDB .local Chicago 2019: Using MongoDB Transactions to Implement Cryptogr...
Query in Couchbase. N1QL: SQL for JSON
Ad

Viewers also liked (13)

PDF
Building social IRC bots with Node.js and MongoDB
PPTX
Welcome to MongoDB Berlin
PPTX
Deployment Best Practices
PPT
Schema Design by Chad Tindel, Solution Architect, 10gen
PDF
Webinar: Was ist neu in MongoDB 2.4
PPTX
Walking the Walk: Developing the MongoDB Backup Service with MongoDB
PPTX
Automated Slow Query Analysis: Dex the Index Robot
PDF
TCO - MongoDB vs. Oracle
PDF
Webinar: Best Practices for Securing and Protecting MongoDB Data
PDF
From Oracle to MongoDB
PDF
Introduction to MongoDB
PDF
Mongo DB
PPT
Introduction to MongoDB
Building social IRC bots with Node.js and MongoDB
Welcome to MongoDB Berlin
Deployment Best Practices
Schema Design by Chad Tindel, Solution Architect, 10gen
Webinar: Was ist neu in MongoDB 2.4
Walking the Walk: Developing the MongoDB Backup Service with MongoDB
Automated Slow Query Analysis: Dex the Index Robot
TCO - MongoDB vs. Oracle
Webinar: Best Practices for Securing and Protecting MongoDB Data
From Oracle to MongoDB
Introduction to MongoDB
Mongo DB
Introduction to MongoDB
Ad

Similar to Webinar: MongoDB for Content Management (20)

PPTX
Novedades de MongoDB 3.6
PPT
MongoDB Tick Data Presentation
PDF
Frontend APIs powering fast paced product iterations
PDF
MongoDB World 2018: Data Models for Storing Sophisticated Customer Journeys i...
PPT
MongoDB - An Agile NoSQL Database
PPTX
MongoDB + Spring
PPTX
MongoDB and Spring - Two leaves of a same tree
PPTX
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
PPTX
Webinar: Build an Application Series - Session 2 - Getting Started
PPTX
Superautomatic! Data Feeds, Bricks, and Blocks, with Server-side Transformat...
PPTX
moma-django overview --> Django + MongoDB: building a custom ORM layer
PDF
Supercharge your data analytics with BigQuery
PPTX
Integrate MongoDB & SQL data with a single REST API
PPTX
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
PDF
Running Data Platforms Like Products
PPT
No SQL and MongoDB - Hyderabad Scalability Meetup
PPTX
MongoDB 3.4 webinar
PPTX
MongoDB.local Atlanta: MongoDB Stitch Tutorial
PDF
MySQL 8.0 Introduction to NoSQL + SQL
PDF
Big Query - Women Techmarkers (Ukraine - March 2014)
Novedades de MongoDB 3.6
MongoDB Tick Data Presentation
Frontend APIs powering fast paced product iterations
MongoDB World 2018: Data Models for Storing Sophisticated Customer Journeys i...
MongoDB - An Agile NoSQL Database
MongoDB + Spring
MongoDB and Spring - Two leaves of a same tree
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
Webinar: Build an Application Series - Session 2 - Getting Started
Superautomatic! Data Feeds, Bricks, and Blocks, with Server-side Transformat...
moma-django overview --> Django + MongoDB: building a custom ORM layer
Supercharge your data analytics with BigQuery
Integrate MongoDB & SQL data with a single REST API
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
Running Data Platforms Like Products
No SQL and MongoDB - Hyderabad Scalability Meetup
MongoDB 3.4 webinar
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MySQL 8.0 Introduction to NoSQL + SQL
Big Query - Women Techmarkers (Ukraine - March 2014)

More from MongoDB (20)

PDF
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
PDF
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
PDF
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
PDF
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
PDF
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
PDF
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
PDF
MongoDB SoCal 2020: MongoDB Atlas Jump Start
PDF
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
PDF
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
PDF
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
PDF
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
PDF
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
PDF
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
PDF
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
PDF
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
PDF
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
PDF
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
PDF
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Encapsulation theory and applications.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Electronic commerce courselecture one. Pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
The Rise and Fall of 3GPP – Time for a Sabbatical?
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Machine learning based COVID-19 study performance prediction
A comparative analysis of optical character recognition models for extracting...
Encapsulation theory and applications.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
sap open course for s4hana steps from ECC to s4
Electronic commerce courselecture one. Pdf
Network Security Unit 5.pdf for BCA BBA.
Encapsulation_ Review paper, used for researhc scholars
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
Review of recent advances in non-invasive hemoglobin estimation
Spectral efficient network and resource selection model in 5G networks
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
The AUB Centre for AI in Media Proposal.docx
Assigned Numbers - 2025 - Bluetooth® Document

Webinar: MongoDB for Content Management

  • 1. Consulting Engineer, 10gen Jason Zucchetto https://twitter.com/mongodb MongoDB for Content Management
  • 2. Agenda • MongoDB Features and Overview • Sample Content Management System (CMS) Application • Schema Design Considerations • Building Feeds and Querying Data • Replication, Failover, and Scaling • Case Studies • Further Resources
  • 3. MongoDB Features • JSON Document Model with Dynamic Schemas • Auto-Sharding for Horizontal Scalability • Text Search • Aggregation Framework and MapReduce • Full, Flexible Index Support and Rich Queries • Built-In Replication for High Availability • Advanced Security • Large Media Storage with GridFS
  • 5. CMS Application Overview • Business news service • Hundreds of stories per day • Millions of website visitors per month • Comments • Related stories • Tags • Company profiles
  • 6. Viewing Stories (Web Site) Headline Date, Byline Copy Comments Tags Related Stories
  • 7. Viewing Categories/Tags (Web Site) Headline Date, Byline Lead Text Headline Date, Byline Lead Text
  • 8. Sample Article Headline Byline, Date, Comments Copy Related Stories Image
  • 10. Sample Relational DB Structure story id headline copy authorid slug … author id first_name last_name title … tag id name … comment Id storyid name Email comment_text … related_story id storyid related_storyid … link_story_tag Id storyid tagid …
  • 11. Sample Relational DB Structure • Number of queries per page load? • Caching layers add complexity • Tables may grow to millions of rows • Joins will become slower over time as db increases in size • Schema changes • Scaling database to handle more reads
  • 12. MongoDB Schema Design • “Dynamic Schema”, however, schema design is important • JSON documents • Design for the use case and work backwards • Avoid a relational model in MongoDB • No joins or transactions, most related information should be contained in the same document • Atomic updates on documents, equivalent of transaction
  • 13. { _id: 375, headline: ”Apple Reports Second Quarter Earnings", date: ISODate("2012-07-14T01:00:00+01:00"), url: “apple-reports-second-quarter-earnings”, byline: { author: “Jason Zucchetto”, title: “Lead Business Editor” }, copy: “Apple reported second quarter revenue today…”, tags: [ ”AAPL", ”Earnings” ], comments: [ { name: “Frank”, comment: “Great story!”} ] } Sample MongoDB Schema
  • 14. { _id: 375, headline: ”Apple Reports Second Quarter Earnings", date: ISODate("2012-07-14T01:00:00+01:00"), url: “apple-reports-second-quarter-earnings”, byline: { author: “Jason Zucchetto”, title: “Lead Business Editor” }, copy: “Apple reported second quarter revenue today…”, tags: [ ”AAPL", ”Earnings” ], image: “/images/aapl/tim-cook.jpg”, ticker: “AAPL” } Adding Fields Based on Story
  • 15. { _id: 375, headline: ”Apple Reports Second Quarter Earnings", date: ISODate("2012-07-14T01:00:00+01:00"), url: “apple-reports-second-quarter-earnings”, … copy: “Apple reported second quarter revenue today…”, tags: [ ”AAPL", ”Earnings” ], last25comments: [ { name: “Frank”, comment: “Great story!”}, { name: “John”, comment: “This is interesting”} … ] } High Comment Volume
  • 16. { _id: 375, headline: ”Apple Reports Second Quarter Earnings", date: ISODate("2012-07-14T01:00:00+01:00"), url: “apple-reports-second-quarter-earnings”, … relatedstories: [ { headline: “Google Reports on Revenue”, date: ISODate("2012-07-15T01:00:00+01:00"), slug: “goog-revenue-third-quarter” }, { headline: “Yahoo Reports on Revenue”, date: ISODate("2012-07-15T01:00:00+01:00"), slug: “yhoo-revenue-third-quarter” } ] } Managing Related Stories
  • 17. { // Story Collection (sample document) _id: 375, headline: ”Apple Reports Second Quarter Earnings", date: ISODate("2012-07-14T01:00:00+01:00"), url: “apple-reports-second-quarter-earnings”, byline: { author: “Jason Zucchetto”, title: “Lead Business Editor” }, copy: “Apple reported second quarter revenue today…”, tags: [ ”AAPL", ”Earnings” ], last25comments: [ { name: “Frank”, comment: “Great story!”}, { name: “John”, comment: “This is interesting”} ] Full Sample Story Schema
  • 18. image: “/images/aapl/tim-cook.jpg”, ticker: “AAPL”, relatedstories: [ { headline: “Google Reports on Revenue”, date: ISODate("2012-07-15T01:00:00+01:00"), slug: “goog-revenue-third-quarter” }, { headline: “Yahoo Reports on Revenue”, date: ISODate("2012-07-15T01:00:00+01:00"), slug: “yhoo-revenue-third-quarter” } ] } Full Sample Story Schema
  • 19. story { headline date url … relatedstories : [] last25comments : [] … companyid } CMS Collections comment { story_id name comment } company { name url location ticker last25stories : [] }
  • 21. // Display a story, related stories, and first page of comments db.story.find( { url: “apple-reports-second-quarter-earnings” }); // Display a story, related stories, and second page of comments db.story.find( { url: “apple-reports-second-quarter-earnings” }); db.comment.find( { story_id : 1234 }).limit(25).skip(25).sort({ date : -1 }); // All Stories for a given tag db.story.find( { tags: “Earnings” }); Querying MongoDB
  • 22. // Display data for a company, latest stories db.company.find( { url: “apple-inc” }); // Display data for a company, all stories db.company.find( { url: “apple-inc” }); db.story.find( { company_id : 1234 }); Querying MongoDB
  • 23. // Inserting new stories are easy, just submit JSON document db.story.insert( { headline: “Apple Reports Revenue”... }); // Adding story tags db.story.update( { _id : 375 }, { $addToSet : { tags : "AAPL" } } ) // Adding a comment (if embedding comments in story) db.story.update( { _id : 375 }, { $push: { comments: { name: „Jason‟, „comment: „Great Story‟} } } ) Inserting and Updating Stories
  • 24. // Index on story slug db.story.ensureIndex( { url: 1 }); // Index on story tags db.story.ensureIndex( { tags: 1 }); MongoDB Indexes for CMS
  • 26. // Very simple to gather specific information for a feed db.story.find( { tags: { $in : [“Earnings”, “AAPL”] } }).sort( { date : -1 }); Query Tags and Sort by Date
  • 28. Replication • Extremely easy to set up • Replica node can trail primary node and maintain a copy of the primary database • Useful for disaster recovery, failover, backups, and specific workloads such as analytics • When Primary goes down, a Secondary will automatically become the new Primary
  • 30. Reading from Secondaries (Delayed Consistency) Reading from Secondaries (Delayed Consistency)
  • 31. Scaling Horizontally • Important to keep working data set in RAM • When working data set exceeds RAM, easy to add additional machines and segment data across machines (sharding)
  • 34. Runs unified data store serving hundreds of diverse web properties on MongoDB Case Study Problem Why MongoDB Results • Hundreds of diverse web properties built on Java-based CMS • Rich documents forced into ill-suited model • Adding new data types, tables to RDBMS killed read performance • Flexible schema • Rich querying and support for secondary index support • Easy to manage replication and scaling • Developers can focus on end-user features instead of back-end storage • Simplified day-to-day operations • Simple to add new brands, content types, etc. to platform
  • 35. Serves targeted content to users using MongoDB- powered identity system Case Study Problem Why MongoDB Results • 20M+ unique visitors per month • Rigid relational schema unable to evolve with changing data types and new features • Slow development cycles • Easy-to-manage dynamic data model enables limitless growth, interactive content • Support for ad hoc queries • Highly extensible • Rapid rollout of new features • Customized, social conversations throughout site • Tracks user data to increase engagement, revenue
  • 36. Powers content-serving web platform on MongoDB to deliver dynamic data to users Case Study Problem Why MongoDB Results • Static web content • Siloed data stores, disparate technologies • Unable to aggregate and integrate data for dynamic content • Support for agile development • Easy to use and maintain • Low subscription and HW costs • Ability to serve dynamic content • Decreased TCO • Replaced multiple technologies with single MongoDB database
  • 37. Resource Location MongoDB Downloads 10gen.com/download Free Online Training education.10gen.com Webinars and Events 10gen.com/events White Papers 10gen.com/white-papers Case Studies 10gen.com/customers Presentations 10gen.com/presentations Documentation docs.mongodb.org Additional Info info@10gen.com For More Information Resource Location
  • 38. Consulting Engineer, 10gen Jason Zucchetto https://twitter.com/mongodb Thank You

Editor's Notes

  • #4: MongoDB provides agility, scalability, and performance without sacrificing the functionality of relational databases, like full index support and rich queriesIndexes: secondary, compound, text search (with MongoDB 2.4), geospatial, and more