SlideShare a Scribd company logo
A short introduction to MongoDB
             Russell Smith
/usr/bin/whoami
•   Russell Smith

•   Consultant for UKD1 Limited

•   Specialising in helping companies going through rapid growth

•   Help with code, architecture, infrastructure, devops, sysops, capacity
    planning, etc

•   <3 gearman, mongodb, neo4j, mysql, kohana, riaksearch, php, debian
What is MongoDB


•   A scalable, high-performance, open source, document-oriented
    database.

•   Stores JSON like documents

•   Indexible on any attributes (like MySQL)
Getting started...


•   Try out the interactive shell at www.mongodb.org (then click try!)

•   Download and install - http://www.mongodb.org/downloads
Basics
•   Common things you do in MySQL or another RDBMS;

•   Insert

•   Select (aka find)

•   Update

•   Delete (aka remove)

•   Index
Create


•   Creating ‘tables’, or in MongoDB terms collections, is not usually
    necessary

•   Ditto for databases
Insert


•   db.test.insert({hello: ‘world’});

•   This insert the document {hello: ‘world’} into the test collection
Let’s check it

•   In MongoDB we find documents rather than SELECTing them...

•   db.test.find()

•   this is the equivalent of SELECT * FROM test;

•   it will return the document we previously inserted
Updates


•   Let’s update the document to say from Russell

•   db.test.update(<documents which match>, <set to x>)

•   db.test.update({hello: ‘world’}, {hello: ‘from Russell’})
Delete?


•   db.test.remove(<where documents match>)

•   Lets remove the last document

•   db.test.remove({hello: ‘from Russell’})
Drop


•   If you no longer want an entire collection, you can drop it which
    removes all the data and indexes;

•   db.test.drop()
Indexes

•   For performance it’s usually a good idea to index your collections.

•   How and which columns depends on what queries you are doing - you
    can get help with this by using ‘explain’ much like in MySQL.

•   db.test.ensureIndex({hello:1})
Further reading
•   I’ve only brushed on the details, but this should be enough to get you
    interested / started with MongoDB. Some of the missing stuff;

•   Updates can also push, set, increment, decrement, etc - http://bit.ly/
    gEfKOr

•   Indexes can be across multiple keys, 2D (geo) and asc / desc - http://
    bit.ly/hpK68Q

•   SQL -> Mongo chart - http://bit.ly/ig1Yfj

More Related Content

What's hot (20)

PDF
Mastering the MongoDB Shell
MongoDB
 
PPTX
MongoDB basics & Introduction
Jerwin Roy
 
PPTX
Mastering the MongoDB Javascript Shell
Scott Hernandez
 
PPTX
Elasticsearch Arcihtecture & What's New in Version 5
Burak TUNGUT
 
PDF
最近 node.js 來勢洶洶, 怎麼辦? 別怕, 我們也有秘密武器 RingoJS!
Liwei Chou
 
PPTX
Shell Tips & Tricks
MongoDB
 
PPTX
Concurrency Patterns with MongoDB
Yann Cluchey
 
PPT
chOpaal -- Senior Project Presentation
asimfayaz
 
PDF
Mongo db basics
Harischandra M K
 
PPTX
Mongo db
Raghu nath
 
PDF
Mongo db
Noman Ellahi
 
PPT
Node.js
Pravin Mishra
 
PPTX
Webinar: Building Your First MongoDB App
MongoDB
 
PPTX
MongoDb and NoSQL
TO THE NEW | Technology
 
KEY
Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
Alex Nguyen
 
PPTX
MongoDB for Beginners
Enoch Joshua
 
PPTX
How to migrate your existing MongoDB and Cassandra Apps to Azure Cosmos DB
Microsoft Tech Community
 
PPTX
Shell Tips and Tricks
MongoDB
 
PDF
Mongo performance tuning: tips and tricks
Vladimir Malyk
 
PPTX
Automated Slow Query Analysis: Dex the Index Robot
MongoDB
 
Mastering the MongoDB Shell
MongoDB
 
MongoDB basics & Introduction
Jerwin Roy
 
Mastering the MongoDB Javascript Shell
Scott Hernandez
 
Elasticsearch Arcihtecture & What's New in Version 5
Burak TUNGUT
 
最近 node.js 來勢洶洶, 怎麼辦? 別怕, 我們也有秘密武器 RingoJS!
Liwei Chou
 
Shell Tips & Tricks
MongoDB
 
Concurrency Patterns with MongoDB
Yann Cluchey
 
chOpaal -- Senior Project Presentation
asimfayaz
 
Mongo db basics
Harischandra M K
 
Mongo db
Raghu nath
 
Mongo db
Noman Ellahi
 
Node.js
Pravin Mishra
 
Webinar: Building Your First MongoDB App
MongoDB
 
MongoDb and NoSQL
TO THE NEW | Technology
 
Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
Alex Nguyen
 
MongoDB for Beginners
Enoch Joshua
 
How to migrate your existing MongoDB and Cassandra Apps to Azure Cosmos DB
Microsoft Tech Community
 
Shell Tips and Tricks
MongoDB
 
Mongo performance tuning: tips and tricks
Vladimir Malyk
 
Automated Slow Query Analysis: Dex the Index Robot
MongoDB
 

Viewers also liked (17)

PDF
Trauma and dissociation neurological and spiritual perspectives
takingflightbooks
 
DOCX
Call2
montsecorrea
 
PPTX
Rails + mongo db
SĂŠrgio Santos
 
PPTX
Fishers social conflict
lala firdaus
 
PDF
An introduction to quantum stochastic calculus
Springer
 
PPT
The 333 digital toolbox
swidzith
 
PPTX
Orientation 2015
derosaMSKCC
 
PDF
Silica Gel Orange MSDS
SORBEAD INDIA
 
PPS
Art of Photography, Igor Zenin
Joke Channel
 
PPT
English4 Foreign On Line Education Student File
dayriza
 
PDF
TSM Summer Internship Report
Sukhjot Singh
 
PDF
Financial Expert Witness Issues: How to Handle the Dangerous Financial Expert...
DecosimoCPAs
 
PPTX
Volvo-OC.org_AAA Traffic Safety Index
Volvoof OrangeCounty
 
PPTX
Douglas Wilson
BNIM
 
PDF
HIDDEN COSTS OF QUALITY: MEASUREMENT & ANALYSIS
ijmvsc
 
PPT
Adliterate aphorisms
Richard Huntington
 
PDF
Usability testing - have fun and improve your work
onthegosystems
 
Trauma and dissociation neurological and spiritual perspectives
takingflightbooks
 
Call2
montsecorrea
 
Rails + mongo db
SĂŠrgio Santos
 
Fishers social conflict
lala firdaus
 
An introduction to quantum stochastic calculus
Springer
 
The 333 digital toolbox
swidzith
 
Orientation 2015
derosaMSKCC
 
Silica Gel Orange MSDS
SORBEAD INDIA
 
Art of Photography, Igor Zenin
Joke Channel
 
English4 Foreign On Line Education Student File
dayriza
 
TSM Summer Internship Report
Sukhjot Singh
 
Financial Expert Witness Issues: How to Handle the Dangerous Financial Expert...
DecosimoCPAs
 
Volvo-OC.org_AAA Traffic Safety Index
Volvoof OrangeCounty
 
Douglas Wilson
BNIM
 
HIDDEN COSTS OF QUALITY: MEASUREMENT & ANALYSIS
ijmvsc
 
Adliterate aphorisms
Richard Huntington
 
Usability testing - have fun and improve your work
onthegosystems
 
Ad

Similar to London MongoDB User Group April 2011 (20)

PPTX
MongoDB using Grails plugin by puneet behl
TO THE NEW | Technology
 
KEY
The Care + Feeding of a Mongodb Cluster
Chris Henry
 
PPTX
MongoDB
Rony Gregory
 
PPT
No sql Database
mymail2ashok
 
PPT
Mongo Bb - NoSQL tutorial
Mohan Rathour
 
PPTX
Mongo DB
Tata Consultancy Services
 
PPT
MongoDB Pros and Cons
johnrjenson
 
PDF
MongoDB: a gentle, friendly overview
Antonio Pintus
 
PDF
10 Reasons to Start Your Analytics Project with PostgreSQL
Satoshi Nagayasu
 
PDF
Introduction to mongo db
Rohit Bishnoi
 
KEY
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Daniel Cousineau
 
PPTX
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
KEY
PostgreSQL
Reuven Lerner
 
PPTX
MongoDB.pptx
Sigit52
 
PPTX
Mongo db
Gyanendra Yadav
 
KEY
Introduction to MongoDB
Sean Laurent
 
PDF
MongoDB for Coder Training (Coding Serbia 2013)
Uwe Printz
 
KEY
Mongodb intro
christkv
 
PPTX
Why databases cry at night
Michael Yarichuk
 
PDF
Test like a_boss
Giuseppe Maxia
 
MongoDB using Grails plugin by puneet behl
TO THE NEW | Technology
 
The Care + Feeding of a Mongodb Cluster
Chris Henry
 
MongoDB
Rony Gregory
 
No sql Database
mymail2ashok
 
Mongo Bb - NoSQL tutorial
Mohan Rathour
 
MongoDB Pros and Cons
johnrjenson
 
MongoDB: a gentle, friendly overview
Antonio Pintus
 
10 Reasons to Start Your Analytics Project with PostgreSQL
Satoshi Nagayasu
 
Introduction to mongo db
Rohit Bishnoi
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Daniel Cousineau
 
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
PostgreSQL
Reuven Lerner
 
MongoDB.pptx
Sigit52
 
Mongo db
Gyanendra Yadav
 
Introduction to MongoDB
Sean Laurent
 
MongoDB for Coder Training (Coding Serbia 2013)
Uwe Printz
 
Mongodb intro
christkv
 
Why databases cry at night
Michael Yarichuk
 
Test like a_boss
Giuseppe Maxia
 
Ad

More from Rainforest QA (10)

PDF
Machine Learning in Practice - CTO Summit Chicago 2019
Rainforest QA
 
PPTX
CTO Summit NASDAQ NYC 2017: Creating a QA Strategy
Rainforest QA
 
PDF
Ops Skills and Tools for Beginners [#MongoDB World 2014]
Rainforest QA
 
PDF
Pragmatic Rails Architecture [SF Rails, 24 Apr 14]
Rainforest QA
 
PDF
Bitcoin Ops & Security Primer
Rainforest QA
 
PDF
Pivotal Labs Lunch Talk; 3 Infrastructure and workflow lessons learned at an ...
Rainforest QA
 
KEY
MongoDB Command Line Tools
Rainforest QA
 
KEY
An Introduction to Map/Reduce with MongoDB
Rainforest QA
 
KEY
How does Riak compare to Cassandra? [Cassandra London User Group July 2011]
Rainforest QA
 
KEY
Geo & capped collections with MongoDB
Rainforest QA
 
Machine Learning in Practice - CTO Summit Chicago 2019
Rainforest QA
 
CTO Summit NASDAQ NYC 2017: Creating a QA Strategy
Rainforest QA
 
Ops Skills and Tools for Beginners [#MongoDB World 2014]
Rainforest QA
 
Pragmatic Rails Architecture [SF Rails, 24 Apr 14]
Rainforest QA
 
Bitcoin Ops & Security Primer
Rainforest QA
 
Pivotal Labs Lunch Talk; 3 Infrastructure and workflow lessons learned at an ...
Rainforest QA
 
MongoDB Command Line Tools
Rainforest QA
 
An Introduction to Map/Reduce with MongoDB
Rainforest QA
 
How does Riak compare to Cassandra? [Cassandra London User Group July 2011]
Rainforest QA
 
Geo & capped collections with MongoDB
Rainforest QA
 

Recently uploaded (20)

PPTX
PUBLIC RELATIONS N6 slides (4).pptx poin
chernae08
 
PPTX
Chapter 3 Distributive Negotiation: Claiming Value
badranomar1990
 
PDF
🚀 Mohit Bansal_ Driving Urban Evolution Through GMI Infra (1).pdf
Mohit Bansal GMI
 
PPTX
E-commerce and its impact on business.
pandeyranjan5483
 
PDF
Equinox Gold - Corporate Presentation.pdf
Equinox Gold Corp.
 
PPTX
Integrative Negotiation: Expanding the Pie
badranomar1990
 
PDF
The New Zealand Business Sales Report 2025_compressed.pdf
charlie630518
 
PPTX
Brain Based Enterprises - Harmonising Man, Woman and Machine
Peter Cook
 
PPTX
Appreciations - July 25.pptxdddddddddddss
anushavnayak
 
PDF
ANÁLISIS DE COSTO- PAUCAR RIVERA NEISY.pdf
neisypaucarr
 
PPTX
Lecture on E Business course Topic 24-34.pptx
MuhammadUzair737846
 
PDF
Infrastructure and geopolitics.AM.ENG.docx.pdf
Andrea Mennillo
 
DOCX
Apply for a Canada Permanent Resident Visa in Delhi with Expert Guidance.docx
WVP International
 
PPTX
Appreciations - July 25.pptxsdsdsddddddsssss
anushavnayak
 
PPTX
Piper 2025 Financial Year Shareholder Presentation
Piper Industries
 
PPTX
Struggling to Land a Social Media Marketing Job Here’s How to Navigate the In...
RahulSharma280537
 
PDF
Gregory Felber - A Dedicated Researcher
Gregory Felber
 
PDF
Driving the Energy Transition India’s Top Renewable Energy Solution Providers...
Essar Group
 
PDF
NewBase 26 July 2025 Energy News issue - 1806 by Khaled Al Awadi_compressed.pdf
Khaled Al Awadi
 
PPTX
FINAL _ DB x Forrester x Workday Webinar Buying Groups July 2025 (1).pptx
smarvin1
 
PUBLIC RELATIONS N6 slides (4).pptx poin
chernae08
 
Chapter 3 Distributive Negotiation: Claiming Value
badranomar1990
 
🚀 Mohit Bansal_ Driving Urban Evolution Through GMI Infra (1).pdf
Mohit Bansal GMI
 
E-commerce and its impact on business.
pandeyranjan5483
 
Equinox Gold - Corporate Presentation.pdf
Equinox Gold Corp.
 
Integrative Negotiation: Expanding the Pie
badranomar1990
 
The New Zealand Business Sales Report 2025_compressed.pdf
charlie630518
 
Brain Based Enterprises - Harmonising Man, Woman and Machine
Peter Cook
 
Appreciations - July 25.pptxdddddddddddss
anushavnayak
 
ANÁLISIS DE COSTO- PAUCAR RIVERA NEISY.pdf
neisypaucarr
 
Lecture on E Business course Topic 24-34.pptx
MuhammadUzair737846
 
Infrastructure and geopolitics.AM.ENG.docx.pdf
Andrea Mennillo
 
Apply for a Canada Permanent Resident Visa in Delhi with Expert Guidance.docx
WVP International
 
Appreciations - July 25.pptxsdsdsddddddsssss
anushavnayak
 
Piper 2025 Financial Year Shareholder Presentation
Piper Industries
 
Struggling to Land a Social Media Marketing Job Here’s How to Navigate the In...
RahulSharma280537
 
Gregory Felber - A Dedicated Researcher
Gregory Felber
 
Driving the Energy Transition India’s Top Renewable Energy Solution Providers...
Essar Group
 
NewBase 26 July 2025 Energy News issue - 1806 by Khaled Al Awadi_compressed.pdf
Khaled Al Awadi
 
FINAL _ DB x Forrester x Workday Webinar Buying Groups July 2025 (1).pptx
smarvin1
 

London MongoDB User Group April 2011

  • 1. A short introduction to MongoDB Russell Smith
  • 2. /usr/bin/whoami • Russell Smith • Consultant for UKD1 Limited • Specialising in helping companies going through rapid growth • Help with code, architecture, infrastructure, devops, sysops, capacity planning, etc • <3 gearman, mongodb, neo4j, mysql, kohana, riaksearch, php, debian
  • 3. What is MongoDB • A scalable, high-performance, open source, document-oriented database. • Stores JSON like documents • Indexible on any attributes (like MySQL)
  • 4. Getting started... • Try out the interactive shell at www.mongodb.org (then click try!) • Download and install - http://www.mongodb.org/downloads
  • 5. Basics • Common things you do in MySQL or another RDBMS; • Insert • Select (aka nd) • Update • Delete (aka remove) • Index
  • 6. Create • Creating ‘tables’, or in MongoDB terms collections, is not usually necessary • Ditto for databases
  • 7. Insert • db.test.insert({hello: ‘world’}); • This insert the document {hello: ‘world’} into the test collection
  • 8. Let’s check it • In MongoDB we nd documents rather than SELECTing them... • db.test.nd() • this is the equivalent of SELECT * FROM test; • it will return the document we previously inserted
  • 9. Updates • Let’s update the document to say from Russell • db.test.update(<documents which match>, <set to x>) • db.test.update({hello: ‘world’}, {hello: ‘from Russell’})
  • 10. Delete? • db.test.remove(<where documents match>) • Lets remove the last document • db.test.remove({hello: ‘from Russell’})
  • 11. Drop • If you no longer want an entire collection, you can drop it which removes all the data and indexes; • db.test.drop()
  • 12. Indexes • For performance it’s usually a good idea to index your collections. • How and which columns depends on what queries you are doing - you can get help with this by using ‘explain’ much like in MySQL. • db.test.ensureIndex({hello:1})
  • 13. Further reading • I’ve only brushed on the details, but this should be enough to get you interested / started with MongoDB. Some of the missing stuff; • Updates can also push, set, increment, decrement, etc - http://bit.ly/ gEfKOr • Indexes can be across multiple keys, 2D (geo) and asc / desc - http:// bit.ly/hpK68Q • SQL -> Mongo chart - http://bit.ly/ig1Yfj

Editor's Notes