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
Apache Spark Architecture
Alexey Grishchenko
 
PPTX
Introduction to Storm
Chandler Huang
 
PDF
Etsy Activity Feeds Architecture
Dan McKinley
 
PDF
Spark SQL
Joud Khattab
 
PPTX
Mongodb basics and architecture
Bishal Khanal
 
PPTX
Introduction to NoSQL Databases
Derek Stainer
 
PPTX
The Basics of MongoDB
valuebound
 
PPTX
NOSQL vs SQL
Mohammed Fazuluddin
 
PDF
MongodB Internals
Norberto Leite
 
PPTX
An Overview of Apache Cassandra
DataStax
 
PDF
Polyglot persistence @ netflix (CDE Meetup)
Roopa Tangirala
 
PPTX
Mongo db intro.pptx
JWORKS powered by Ordina
 
PPTX
From cache to in-memory data grid. Introduction to Hazelcast.
Taras Matyashovsky
 
PDF
Non Relational Databases
Chris Baglieri
 
PDF
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Databricks
 
PDF
MongoDB Fundamentals
MongoDB
 
PPTX
MongoDB presentation
Hyphen Call
 
PDF
Spark SQL Deep Dive @ Melbourne Spark Meetup
Databricks
 
PPTX
Spark architecture
GauravBiswas9
 
PPTX
MongoDB at Scale
MongoDB
 
Apache Spark Architecture
Alexey Grishchenko
 
Introduction to Storm
Chandler Huang
 
Etsy Activity Feeds Architecture
Dan McKinley
 
Spark SQL
Joud Khattab
 
Mongodb basics and architecture
Bishal Khanal
 
Introduction to NoSQL Databases
Derek Stainer
 
The Basics of MongoDB
valuebound
 
NOSQL vs SQL
Mohammed Fazuluddin
 
MongodB Internals
Norberto Leite
 
An Overview of Apache Cassandra
DataStax
 
Polyglot persistence @ netflix (CDE Meetup)
Roopa Tangirala
 
Mongo db intro.pptx
JWORKS powered by Ordina
 
From cache to in-memory data grid. Introduction to Hazelcast.
Taras Matyashovsky
 
Non Relational Databases
Chris Baglieri
 
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Databricks
 
MongoDB Fundamentals
MongoDB
 
MongoDB presentation
Hyphen Call
 
Spark SQL Deep Dive @ Melbourne Spark Meetup
Databricks
 
Spark architecture
GauravBiswas9
 
MongoDB at Scale
MongoDB
 

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
Introduction to MongoDB
antoinegirbal
 
PPT
2011 Mongo FR - MongoDB introduction
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
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
MongoDB
 
PPTX
Marc s01 e02-crud-database
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
 
Introduction to MongoDB
antoinegirbal
 
2011 Mongo FR - MongoDB introduction
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
 
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
MongoDB
 
Marc s01 e02-crud-database
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)

PPTX
Machine Learning Benefits Across Industries
SynapseIndia
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
Novus Safe Lite- What is Novus Safe Lite.pdf
Novus Hi-Tech
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PDF
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
PPTX
Top Managed Service Providers in Los Angeles
Captain IT
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
PDF
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
PDF
Shuen Mei Parth Sharma Boost Productivity, Innovation and Efficiency wit...
AWS Chicago
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
Generative AI in Healthcare: Benefits, Use Cases & Challenges
Lily Clark
 
PDF
How Current Advanced Cyber Threats Transform Business Operation
Eryk Budi Pratama
 
PPTX
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
Machine Learning Benefits Across Industries
SynapseIndia
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Novus Safe Lite- What is Novus Safe Lite.pdf
Novus Hi-Tech
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
Top Managed Service Providers in Los Angeles
Captain IT
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
Shuen Mei Parth Sharma Boost Productivity, Innovation and Efficiency wit...
AWS Chicago
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Generative AI in Healthcare: Benefits, Use Cases & Challenges
Lily Clark
 
How Current Advanced Cyber Threats Transform Business Operation
Eryk Budi Pratama
 
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy