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

KEY
Seedhack MongoDB 2011
PDF
Elasticsearch in production
PPTX
Introduction to mongo db
PPTX
MongoDB
PPTX
Mongo db nosql (1)
PPTX
MongoDB
ODP
PPTX
MongoDB Shell Tips & Tricks
Seedhack MongoDB 2011
Elasticsearch in production
Introduction to mongo db
MongoDB
Mongo db nosql (1)
MongoDB
MongoDB Shell Tips & Tricks

What's hot (20)

PDF
Mastering the MongoDB Shell
PPTX
MongoDB basics & Introduction
PPTX
Mastering the MongoDB Javascript Shell
PPTX
Elasticsearch Arcihtecture & What's New in Version 5
PDF
最近 node.js 來勢洶洶, 怎麼辦? 別怕, 我們也有秘密武器 RingoJS!
PPTX
Shell Tips & Tricks
PPTX
Concurrency Patterns with MongoDB
PPT
chOpaal -- Senior Project Presentation
PDF
Mongo db basics
PPTX
Mongo db
PDF
Mongo db
PPT
Node.js
PPTX
Webinar: Building Your First MongoDB App
PPTX
MongoDb and NoSQL
KEY
Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
PPTX
MongoDB for Beginners
PPTX
How to migrate your existing MongoDB and Cassandra Apps to Azure Cosmos DB
PPTX
Shell Tips and Tricks
PDF
Mongo performance tuning: tips and tricks
PPTX
Automated Slow Query Analysis: Dex the Index Robot
Mastering the MongoDB Shell
MongoDB basics & Introduction
Mastering the MongoDB Javascript Shell
Elasticsearch Arcihtecture & What's New in Version 5
最近 node.js 來勢洶洶, 怎麼辦? 別怕, 我們也有秘密武器 RingoJS!
Shell Tips & Tricks
Concurrency Patterns with MongoDB
chOpaal -- Senior Project Presentation
Mongo db basics
Mongo db
Mongo db
Node.js
Webinar: Building Your First MongoDB App
MongoDb and NoSQL
Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
MongoDB for Beginners
How to migrate your existing MongoDB and Cassandra Apps to Azure Cosmos DB
Shell Tips and Tricks
Mongo performance tuning: tips and tricks
Automated Slow Query Analysis: Dex the Index Robot
Ad

Viewers also liked (17)

PDF
Trauma and dissociation neurological and spiritual perspectives
DOCX
PPTX
Rails + mongo db
PPTX
Fishers social conflict
PDF
An introduction to quantum stochastic calculus
PPT
The 333 digital toolbox
PPTX
Orientation 2015
PDF
Silica Gel Orange MSDS
PPS
Art of Photography, Igor Zenin
PPT
English4 Foreign On Line Education Student File
PDF
TSM Summer Internship Report
PDF
Financial Expert Witness Issues: How to Handle the Dangerous Financial Expert...
PPTX
Volvo-OC.org_AAA Traffic Safety Index
PPTX
Douglas Wilson
PDF
HIDDEN COSTS OF QUALITY: MEASUREMENT & ANALYSIS
PPT
Adliterate aphorisms
PDF
Usability testing - have fun and improve your work
Trauma and dissociation neurological and spiritual perspectives
Rails + mongo db
Fishers social conflict
An introduction to quantum stochastic calculus
The 333 digital toolbox
Orientation 2015
Silica Gel Orange MSDS
Art of Photography, Igor Zenin
English4 Foreign On Line Education Student File
TSM Summer Internship Report
Financial Expert Witness Issues: How to Handle the Dangerous Financial Expert...
Volvo-OC.org_AAA Traffic Safety Index
Douglas Wilson
HIDDEN COSTS OF QUALITY: MEASUREMENT & ANALYSIS
Adliterate aphorisms
Usability testing - have fun and improve your work
Ad

Similar to London MongoDB User Group April 2011 (20)

PPTX
MongoDB using Grails plugin by puneet behl
KEY
The Care + Feeding of a Mongodb Cluster
PPTX
MongoDB
PPT
No sql Database
PPT
Mongo Bb - NoSQL tutorial
PPT
MongoDB Pros and Cons
PDF
MongoDB: a gentle, friendly overview
PDF
10 Reasons to Start Your Analytics Project with PostgreSQL
PDF
Introduction to mongo db
KEY
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
PPTX
MongoDB_ppt.pptx
KEY
PostgreSQL
PPTX
MongoDB.pptx
PPTX
Mongo db
KEY
Introduction to MongoDB
PDF
MongoDB for Coder Training (Coding Serbia 2013)
KEY
Mongodb intro
PPTX
Why databases cry at night
PDF
Test like a_boss
MongoDB using Grails plugin by puneet behl
The Care + Feeding of a Mongodb Cluster
MongoDB
No sql Database
Mongo Bb - NoSQL tutorial
MongoDB Pros and Cons
MongoDB: a gentle, friendly overview
10 Reasons to Start Your Analytics Project with PostgreSQL
Introduction to mongo db
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
MongoDB_ppt.pptx
PostgreSQL
MongoDB.pptx
Mongo db
Introduction to MongoDB
MongoDB for Coder Training (Coding Serbia 2013)
Mongodb intro
Why databases cry at night
Test like a_boss

More from Rainforest QA (10)

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

Recently uploaded (20)

PDF
Reconciliation AND MEMORANDUM RECONCILATION
PDF
Katrina Stoneking: Shaking Up the Alcohol Beverage Industry
PDF
Business model innovation report 2022.pdf
PDF
MSPs in 10 Words - Created by US MSP Network
PPTX
sales presentation، Training Overview.pptx
PPTX
The Marketing Journey - Tracey Phillips - Marketing Matters 7-2025.pptx
PDF
Hindu Circuler Economy - Model (Concept)
PDF
A Brief Introduction About Julia Allison
PDF
Nidhal Samdaie CV - International Business Consultant
PDF
pdfcoffee.com-opt-b1plus-sb-answers.pdfvi
PPT
Chapter four Project-Preparation material
PDF
The FMS General Management Prep-Book 2025.pdf
DOCX
Business Management - unit 1 and 2
PPTX
HR Introduction Slide (1).pptx on hr intro
PDF
kom-180-proposal-for-a-directive-amending-directive-2014-45-eu-and-directive-...
PPT
Data mining for business intelligence ch04 sharda
PDF
Chapter 5_Foreign Exchange Market in .pdf
PPTX
AI-assistance in Knowledge Collection and Curation supporting Safe and Sustai...
PPTX
Lecture (1)-Introduction.pptx business communication
PPTX
job Avenue by vinith.pptxvnbvnvnvbnvbnbmnbmbh
Reconciliation AND MEMORANDUM RECONCILATION
Katrina Stoneking: Shaking Up the Alcohol Beverage Industry
Business model innovation report 2022.pdf
MSPs in 10 Words - Created by US MSP Network
sales presentation، Training Overview.pptx
The Marketing Journey - Tracey Phillips - Marketing Matters 7-2025.pptx
Hindu Circuler Economy - Model (Concept)
A Brief Introduction About Julia Allison
Nidhal Samdaie CV - International Business Consultant
pdfcoffee.com-opt-b1plus-sb-answers.pdfvi
Chapter four Project-Preparation material
The FMS General Management Prep-Book 2025.pdf
Business Management - unit 1 and 2
HR Introduction Slide (1).pptx on hr intro
kom-180-proposal-for-a-directive-amending-directive-2014-45-eu-and-directive-...
Data mining for business intelligence ch04 sharda
Chapter 5_Foreign Exchange Market in .pdf
AI-assistance in Knowledge Collection and Curation supporting Safe and Sustai...
Lecture (1)-Introduction.pptx business communication
job Avenue by vinith.pptxvnbvnvnvbnvbnbmnbmbh

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 find) • 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 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
  • 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