SlideShare a Scribd company logo
open-­‐source,	
  high-­‐performance,	
  
 document-­‐oriented	
  database
Non-relational
                         Operational Stores
                                    (“NoSQL”)




New Gen. OLAP                                     RDBMS
(vertica,	
  aster,	
  greenplum)               (Oracle,	
  MySQL)
NoSQL Really Means:
 non-­‐relational,	
  next-­‐generation	
  
 operational	
  datastores	
  and	
  databases
no	
  joins
+   no	
  complex	
  transactions

Horizontally Scalable
        Architectures
no	
  joins
+   no	
  complex	
  transactions

    New Data Models
New Data Models
improved	
  ways	
  to	
  develop	
  applications?
Data Models
           Key	
  /	
  Value
      memcached,	
  Dynamo

             Tabular
              BigTable

     Document	
  Oriented
MongoDB,	
  CouchDB,	
  JSON	
  stores
• memcached
scalability	
  &	
  performance



                                      • key/value



                                                                            •   RDBMS




                                             depth	
  of	
  functionality
JSON-style Documents
           represented	
  as	
  BSON

      {“hello”:	
  “world”}

  x16x00x00x00x02hello
  x00x06x00x00x00world
  x00x00


                            http://bsonspec.org
Flexible “Schemas”

                        {“author”:	
  “eliot”,
{“author”:	
  “mike”,
                        	
  “text”:	
  “...”,
	
  “text”:	
  “...”}
                        	
  “tags”:	
  [“mongodb”]}
Dynamic Queries
Atomic Update
  Modifiers
Focus on Performance
Replication
                            master   slave

        master
                            master   slave


slave       slave   slave   master   master

                             slave   master
Auto-sharding
                   Shards
          mongod   mongod    mongod
                                            ...
Config     mongod   mongod    mongod
Servers

mongod

mongod

mongod
                   mongos    mongos   ...


                    client
Many Supported
Platforms / Languages
Best Use Cases
                                        T

Scaling	
  Out
                              Caching
                 The	
  Web

            High	
  Volume
Less Good At
     highly	
  transactional


ad-­‐hoc	
  business	
  intelligence


problems	
  that	
  require	
  SQL
A Quick Aside
_id                  special	
  key
  present	
  in	
  all	
  documents
 unique	
  across	
  a	
  Collection
           any	
  type	
  you	
  want
Post

{author:	
  “mike”,
	
  date:	
  new	
  Date(),
	
  text:	
  “my	
  blog	
  post...”,
	
  tags:	
  [“mongodb”,	
  “intro”]}
Comment

{author:	
  “eliot”,
	
  date:	
  new	
  Date(),
	
  text:	
  “great	
  post!”}
New Post
post	
  =	
  {author:	
  “mike”,
	
  	
  date:	
  new	
  Date(),
	
  	
  text:	
  “my	
  blog	
  post...”,
	
  	
  tags:	
  [“mongodb”,	
  “intro”]}

db.posts.save(post)
Embedding a Comment

c	
  =	
  {author:	
  “eliot”,
	
  	
  date:	
  new	
  Date(),
	
  	
  text:	
  “great	
  post!”}

db.posts.update({_id:	
  post._id},	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {$push:	
  {comments:	
  c}})
Posts by Author


db.posts.find({author:	
  “mike”})
Last 10 Posts

db.posts.find()
	
  	
  	
  	
  	
  	
  	
  	
  .sort({date:	
  -­‐1})
	
  	
  	
  	
  	
  	
  	
  	
  .limit(10)
Posts Since April 1

april_1	
  =	
  new	
  Date(2010,	
  3,	
  1)

db.posts.find({date:	
  {$gt:	
  april_1}})
Posts Ending With ‘Tech’


db.posts.find({text:	
  /Tech$/})
Posts With a Tag
db.posts.find({tags:	
  “mongodb”})


          ...and Fast
                 (multi-­‐key	
  indexes)

db.posts.ensureIndex({tags:	
  1})
Indexing / Querying
    on Embedded Docs
                            (dot	
  notation)

db.posts.ensureIndex({“comments.author”:	
  1})

db.posts.find({“comments.author”:	
  “eliot”})
Counting Posts


db.posts.count()

db.posts.find({author:	
  “mike”}).count()
Basic Paging

page	
  =	
  2
page_size	
  =	
  15

db.posts.find().limit(page_size)
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .skip(page	
  *	
  page_size)
Migration: Adding Titles
                                        (just	
  start	
  adding	
  them)

post	
  =	
  {author:	
  “mike”,
	
  	
  	
  	
  	
  	
  	
  	
  date:	
  new	
  Date(),
	
  	
  	
  	
  	
  	
  	
  	
  text:	
  “another	
  blog	
  post...”,
	
  	
  	
  	
  	
  	
  	
  	
  tags:	
  [“mongodb”],
     	
  	
  	
  	
  	
  	
  	
  title:	
  “MongoDB	
  for	
  Fun	
  and	
  Profit”}

post_id	
  =	
  db.posts.save(post)
Advanced Queries

             $gt,	
  $lt,	
  $gte,	
  $lte,	
  $ne,	
  $all,	
  $in,	
  $nin


db.posts.find({$where:	
  “this.author	
  ==	
  ‘mike’	
  ||
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  this.title	
  ==	
  ‘foo’”})
Other Cool Stuff
aggregation	
  and	
  map/reduce
capped	
  collections
unique	
  indexes
mongo	
  shell
GridFS
geo
slides	
  will	
  be	
  up	
  on	
  http://dirolf.com




Download MongoDB
         http://www.mongodb.org




   and	
  let	
  us	
  know	
  what	
  you	
  think
       @mdirolf	
  	
  	
  	
  @mongodb

More Related Content

What's hot (20)

PPTX
Introduction to Storm
Chandler Huang
 
PPTX
Mongodb basics and architecture
Bishal Khanal
 
PDF
MongoDB Fundamentals
MongoDB
 
PPTX
Apache Spark Architecture
Alexey Grishchenko
 
PPTX
HBase and HDFS: Understanding FileSystem Usage in HBase
enissoz
 
PDF
Etsy Activity Feeds Architecture
Dan McKinley
 
PPT
Introduction to mongodb
neela madheswari
 
PPTX
Introduction to Redis
Arnab Mitra
 
PDF
Scalability, Availability & Stability Patterns
Jonas Bonér
 
PDF
Monitoring Kubernetes with Prometheus
Grafana Labs
 
PDF
MongoDB Sharding Fundamentals
Antonios Giannopoulos
 
PPTX
Introduction to Redis
Maarten Smeets
 
PDF
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
ScaleGrid.io
 
PPTX
MongoDB.pptx
Sigit52
 
PPTX
Elastic Stack Introduction
Vikram Shinde
 
PPTX
Introduction to Redis
TO THE NEW | Technology
 
PPTX
Hive Tutorial | Hive Architecture | Hive Tutorial For Beginners | Hive In Had...
Simplilearn
 
PDF
BlueStore, A New Storage Backend for Ceph, One Year In
Sage Weil
 
PPTX
Getting started with postgresql
botsplash.com
 
Introduction to Storm
Chandler Huang
 
Mongodb basics and architecture
Bishal Khanal
 
MongoDB Fundamentals
MongoDB
 
Apache Spark Architecture
Alexey Grishchenko
 
HBase and HDFS: Understanding FileSystem Usage in HBase
enissoz
 
Etsy Activity Feeds Architecture
Dan McKinley
 
Introduction to mongodb
neela madheswari
 
Introduction to Redis
Arnab Mitra
 
Scalability, Availability & Stability Patterns
Jonas Bonér
 
Monitoring Kubernetes with Prometheus
Grafana Labs
 
MongoDB Sharding Fundamentals
Antonios Giannopoulos
 
Introduction to Redis
Maarten Smeets
 
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
ScaleGrid.io
 
MongoDB.pptx
Sigit52
 
Elastic Stack Introduction
Vikram Shinde
 
Introduction to Redis
TO THE NEW | Technology
 
Hive Tutorial | Hive Architecture | Hive Tutorial For Beginners | Hive In Had...
Simplilearn
 
BlueStore, A New Storage Backend for Ceph, One Year In
Sage Weil
 
Getting started with postgresql
botsplash.com
 

Similar to Introduction to MongoDB (20)

PDF
MongoDB at FrozenRails
Mike Dirolf
 
PPTX
Intro to mongodb mongouk jun2010
Skills Matter
 
KEY
MongoDB at CodeMash 2.0.1.0
Mike Dirolf
 
KEY
MongoDB at ZPUGDC
Mike Dirolf
 
PDF
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
boychatmate1
 
KEY
MongoDB at RuPy
Mike Dirolf
 
KEY
MongoDB NYC Python
Mike Dirolf
 
KEY
MongoDB Strange Loop 2009
Mike Dirolf
 
KEY
Mongodb intro
christkv
 
KEY
Introduction to MongoDB
Alex Bilbie
 
KEY
MongoDB, PHP and the cloud - php cloud summit 2011
Steven Francia
 
PPT
2011 Mongo FR - MongoDB introduction
antoinegirbal
 
PPT
Introduction to MongoDB
antoinegirbal
 
PDF
Building your first app with MongoDB
Norberto Leite
 
KEY
Managing Social Content with MongoDB
MongoDB
 
PDF
Using MongoDB and Python
Mike Bright
 
PDF
2016 feb-23 pyugre-py_mongo
Michael Bright
 
PPTX
Marc s01 e02-crud-database
MongoDB
 
PPTX
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
MongoDB
 
KEY
MongoDB Hadoop DC
Mike Dirolf
 
MongoDB at FrozenRails
Mike Dirolf
 
Intro to mongodb mongouk jun2010
Skills Matter
 
MongoDB at CodeMash 2.0.1.0
Mike Dirolf
 
MongoDB at ZPUGDC
Mike Dirolf
 
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
boychatmate1
 
MongoDB at RuPy
Mike Dirolf
 
MongoDB NYC Python
Mike Dirolf
 
MongoDB Strange Loop 2009
Mike Dirolf
 
Mongodb intro
christkv
 
Introduction to MongoDB
Alex Bilbie
 
MongoDB, PHP and the cloud - php cloud summit 2011
Steven Francia
 
2011 Mongo FR - MongoDB introduction
antoinegirbal
 
Introduction to MongoDB
antoinegirbal
 
Building your first app with MongoDB
Norberto Leite
 
Managing Social Content with MongoDB
MongoDB
 
Using MongoDB and Python
Mike Bright
 
2016 feb-23 pyugre-py_mongo
Michael Bright
 
Marc s01 e02-crud-database
MongoDB
 
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
MongoDB
 
MongoDB Hadoop DC
Mike Dirolf
 
Ad

More from Mike Dirolf (13)

PDF
Indexing
Mike Dirolf
 
PDF
Inside MongoDB: the Internals of an Open-Source Database
Mike Dirolf
 
KEY
Inside PyMongo - MongoNYC
Mike Dirolf
 
PDF
FrozenRails Training
Mike Dirolf
 
KEY
Python Development (MongoSF)
Mike Dirolf
 
KEY
MongoDB: How it Works
Mike Dirolf
 
KEY
MongoDB hearts Django? (Django NYC)
Mike Dirolf
 
PDF
MongoDB at RubyConf
Mike Dirolf
 
KEY
MongoDB at RubyEnRails 2009
Mike Dirolf
 
KEY
MongoDB London PHP
Mike Dirolf
 
KEY
MongoDB EuroPython 2009
Mike Dirolf
 
KEY
MongoDB SF Python
Mike Dirolf
 
KEY
MongoDB SF Ruby
Mike Dirolf
 
Indexing
Mike Dirolf
 
Inside MongoDB: the Internals of an Open-Source Database
Mike Dirolf
 
Inside PyMongo - MongoNYC
Mike Dirolf
 
FrozenRails Training
Mike Dirolf
 
Python Development (MongoSF)
Mike Dirolf
 
MongoDB: How it Works
Mike Dirolf
 
MongoDB hearts Django? (Django NYC)
Mike Dirolf
 
MongoDB at RubyConf
Mike Dirolf
 
MongoDB at RubyEnRails 2009
Mike Dirolf
 
MongoDB London PHP
Mike Dirolf
 
MongoDB EuroPython 2009
Mike Dirolf
 
MongoDB SF Python
Mike Dirolf
 
MongoDB SF Ruby
Mike Dirolf
 
Ad

Recently uploaded (20)

PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
NASA A Researcher’s Guide to International Space Station : Earth Observations
Dr. PANKAJ DHUSSA
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PPTX
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
PDF
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
Edge AI and Vision Alliance
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
PDF
Linux schedulers for fun and profit with SchedKit
Alessio Biancalana
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Digital Circuits, important subject in CS
contactparinay1
 
NASA A Researcher’s Guide to International Space Station : Earth Observations
Dr. PANKAJ DHUSSA
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
Edge AI and Vision Alliance
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
Linux schedulers for fun and profit with SchedKit
Alessio Biancalana
 

Introduction to MongoDB

  • 1. open-­‐source,  high-­‐performance,   document-­‐oriented  database
  • 2. Non-relational Operational Stores (“NoSQL”) New Gen. OLAP RDBMS (vertica,  aster,  greenplum) (Oracle,  MySQL)
  • 3. NoSQL Really Means: non-­‐relational,  next-­‐generation   operational  datastores  and  databases
  • 4. no  joins + no  complex  transactions Horizontally Scalable Architectures
  • 5. no  joins + no  complex  transactions New Data Models
  • 6. New Data Models improved  ways  to  develop  applications?
  • 7. Data Models Key  /  Value memcached,  Dynamo Tabular BigTable Document  Oriented MongoDB,  CouchDB,  JSON  stores
  • 8. • memcached scalability  &  performance • key/value • RDBMS depth  of  functionality
  • 9. JSON-style Documents represented  as  BSON {“hello”:  “world”} x16x00x00x00x02hello x00x06x00x00x00world x00x00 http://bsonspec.org
  • 10. Flexible “Schemas” {“author”:  “eliot”, {“author”:  “mike”,  “text”:  “...”,  “text”:  “...”}  “tags”:  [“mongodb”]}
  • 12. Atomic Update Modifiers
  • 14. Replication master slave master master slave slave slave slave master master slave master
  • 15. Auto-sharding Shards mongod mongod mongod ... Config mongod mongod mongod Servers mongod mongod mongod mongos mongos ... client
  • 17. Best Use Cases T Scaling  Out Caching The  Web High  Volume
  • 18. Less Good At highly  transactional ad-­‐hoc  business  intelligence problems  that  require  SQL
  • 19. A Quick Aside _id special  key present  in  all  documents unique  across  a  Collection any  type  you  want
  • 20. Post {author:  “mike”,  date:  new  Date(),  text:  “my  blog  post...”,  tags:  [“mongodb”,  “intro”]}
  • 21. Comment {author:  “eliot”,  date:  new  Date(),  text:  “great  post!”}
  • 22. New Post post  =  {author:  “mike”,    date:  new  Date(),    text:  “my  blog  post...”,    tags:  [“mongodb”,  “intro”]} db.posts.save(post)
  • 23. Embedding a Comment c  =  {author:  “eliot”,    date:  new  Date(),    text:  “great  post!”} db.posts.update({_id:  post._id},                                  {$push:  {comments:  c}})
  • 25. Last 10 Posts db.posts.find()                .sort({date:  -­‐1})                .limit(10)
  • 26. Posts Since April 1 april_1  =  new  Date(2010,  3,  1) db.posts.find({date:  {$gt:  april_1}})
  • 27. Posts Ending With ‘Tech’ db.posts.find({text:  /Tech$/})
  • 28. Posts With a Tag db.posts.find({tags:  “mongodb”}) ...and Fast (multi-­‐key  indexes) db.posts.ensureIndex({tags:  1})
  • 29. Indexing / Querying on Embedded Docs (dot  notation) db.posts.ensureIndex({“comments.author”:  1}) db.posts.find({“comments.author”:  “eliot”})
  • 31. Basic Paging page  =  2 page_size  =  15 db.posts.find().limit(page_size)                              .skip(page  *  page_size)
  • 32. Migration: Adding Titles (just  start  adding  them) post  =  {author:  “mike”,                date:  new  Date(),                text:  “another  blog  post...”,                tags:  [“mongodb”],              title:  “MongoDB  for  Fun  and  Profit”} post_id  =  db.posts.save(post)
  • 33. Advanced Queries $gt,  $lt,  $gte,  $lte,  $ne,  $all,  $in,  $nin db.posts.find({$where:  “this.author  ==  ‘mike’  ||                                                this.title  ==  ‘foo’”})
  • 34. Other Cool Stuff aggregation  and  map/reduce capped  collections unique  indexes mongo  shell GridFS geo
  • 35. slides  will  be  up  on  http://dirolf.com Download MongoDB http://www.mongodb.org and  let  us  know  what  you  think @mdirolf        @mongodb