Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
MongoDB 101
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Nick Jackson
May 07, 2012
Technology
1
120
MongoDB 101
A crash course on MongoDB I gave to attendees at the JISC MRD Hackday organised by DevCSI.
Nick Jackson
May 07, 2012
Tweet
Share
More Decks by Nick Jackson
See All by Nick Jackson
It's all about the data.
jacksonj04
0
82
Development Tools
jacksonj04
0
100
Eating Your Own Dog Food
jacksonj04
0
340
LNCD and The Cloud
jacksonj04
0
120
OAuth 101
jacksonj04
3
370
API Driven Development
jacksonj04
0
220
We Can Haz Ur Datas?!
jacksonj04
0
350
Universal Search at Lincoln
jacksonj04
0
48
Jerome Overview
jacksonj04
0
50
Other Decks in Technology
See All in Technology
生成AI時代にこそ求められるSRE / SRE for Gen AI era
ymotongpoo
5
3k
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
210
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.6k
SREチームをどう作り、どう育てるか ― Findy横断SREのマネジメント
rvirus0817
0
130
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
460
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
190
こんなところでも(地味に)活躍するImage Modeさんを知ってるかい?- Image Mode for OpenShift -
tsukaman
0
120
MCPでつなぐElasticsearchとLLM - 深夜の障害対応を楽にしたい / Bridging Elasticsearch and LLMs with MCP
sashimimochi
0
150
今日から始めるAmazon Bedrock AgentCore
har1101
4
400
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
920
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1k
Amazon Bedrock Knowledge Basesチャンキング解説!
aoinoguchi
0
130
Featured
See All Featured
Test your architecture with Archunit
thirion
1
2.1k
Building Adaptive Systems
keathley
44
2.9k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
A Tale of Four Properties
chriscoyier
162
24k
Tell your own story through comics
letsgokoyo
1
810
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
300
The browser strikes back
jonoalderson
0
360
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Balancing Empowerment & Direction
lara
5
880
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
Transcript
MongoDB 101
I am... • Nick Jackson • Awesome Developer Dude •
University of Lincoln • @jacksonj04
MongoDB Is... • A NoSQL document database.
Eh?
NoSQL • Is not a specification (unlike SQL). • (Generally)
doesn’t have schemas. • (Generally) works at web-scale. • (Generally) doesn’t do relational integrity.
Document Databases • Store documents. • Don’t store key-value pairs.
• Make building APIs and stuff really easy.
Ye Olde SQL id name email 1 Nick
[email protected]
2
Joss
[email protected]
Ye Olde SQL id name email office building 1 Nick
... 3107 MHT 2 Joss ... 3015 MHT 3 Harry ... NULL MHT
:-(
Documents: Awesome! { name: ‘Nick’, email: ‘
[email protected]
’, location: { office:
‘3105’, building: ‘MHT’ } }
Documents: Awesome! { name: ‘Harry’, email: ‘
[email protected]
’ }
Documents: Awesome! { name: ‘Joss’, email: ‘
[email protected]
’, location: { office:
‘3105’, building: ‘MHT’ }, likes: { music: [‘Folk’, ‘Hip-Hop’], drink: [‘Coffee’, ‘Ale’] } }
Servers Are Easy
On Its Own Mongo App
Replicated Mongo 1 Mongo 2 Mongo 3 App
Sharded App Router 1 Router 2 Mongo S1 Mongo S2
Mongo S3
http://mongodb.org
Inserts <3 JSON > db.people.save({name:'Nick'}) > db.people.save({name:'Joss'}) > db.people.save({name:'Harry'})
Query Be Simple... > db.people.find() { "_id" : ObjectId("4fa...103"), "name"
: "Nick" } { "_id" : ObjectId("4fa...104"), "name" : "Joss" } { "_id" : ObjectId("4fa...105"), "name" : "Harry" }
Query Be Simple... > db.people.find({name:'Nick'}) { "_id" : ObjectId("4fa...103"), "name"
: "Nick" }
Query Be Quick... > db.people.ensureIndex({name:1})
Updates are easy > db.people.update({name:'Nick'},{name:'Nick',likes: ['coffee']}) > db.people.find({name:'Nick'}) { "_id"
: ObjectId("4fa...103"), "name" : "Nick", "likes" : [ "coffee" ] }
Queries are powerful > db.people.update({name:'Joss'},{name:'Joss',likes: ['coffee','folk music']}) > db.people.find({likes:'coffee'}) {
"_id" : ObjectId("4fa...103"), "name" : "Nick", "likes" : [ "coffee" ] } { "_id" : ObjectId("4fa...104"), "name" : "Joss", "likes" : [ "coffee", "folk music" ] }
Deletes are also easy > db.people.remove({name:'Nick'}) > db.people.find() { "_id"
: ObjectId("4fa...104"), "name" : "Joss", "likes" : [ "coffee", "folk music" ] } { "_id" : ObjectId("4fa...105"), "name" : "Harry" }
Cool Things! • Geospatial indexes. db.places.find({loc:{$near:[-2, 53]}}) • JavaScript in
the Mongo shell. • Map/Reduce operations. • Can be used as a filesystem.
Downsides It has a few
It’s not ACID • Set of atomic operators, but no
things like transactions. • No enforced consistency. At all. • No locking, so updates can collide and be lost. • Disk writes are (usually) deferred, so data can be lost in failures.
It’s not ‘Enterprise’ • Your DBAs will find it new
and scary. • You need to un-learn a lot of the SQL mindset. • It’s not seen as ‘proven’, but this is generally rubbish.
Some MongoDB Users • Craigslist • MTV • SourceForge •
Disney • National Archives • HM Government • The Guardian • New York Times • bit.ly • GitHub • Foursquare • http://lncn.eu/fhx5