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
Nick Jackson
May 07, 2012
Technology
120
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MongoDB 101
A crash course on MongoDB I gave to attendees at the JISC MRD Hackday organised by DevCSI.
Nick Jackson
May 07, 2012
More Decks by Nick Jackson
See All by Nick Jackson
It's all about the data.
jacksonj04
0
93
Development Tools
jacksonj04
0
110
Eating Your Own Dog Food
jacksonj04
0
350
LNCD and The Cloud
jacksonj04
0
130
OAuth 101
jacksonj04
3
370
API Driven Development
jacksonj04
0
220
We Can Haz Ur Datas?!
jacksonj04
0
360
Universal Search at Lincoln
jacksonj04
0
55
Jerome Overview
jacksonj04
0
56
Other Decks in Technology
See All in Technology
生成 AI 時代にいま一度「問い合わせ」について考えてみる
kazzpapa3
1
130
Alphaモジュール使っていいのかい!?いけないのかい!?どっちなんだいっ!?
watany
1
320
発表と総括 / Presentations and Summary
ks91
PRO
0
190
20260720_クラウド女子会×PyLadiesTokyoコラボ Amazon Bedrock ハンズオン用資料
yuuka51
2
110
壊して学ぶAWS CDK: そのcdk deployで消えるもの、残るもの
k_adachi_01
1
480
「守りたい体験」を渡すだけで E2E を生成させられるようになった話
hinac0
2
1k
副作用のある Lambda でも Lambda Power Tuning は使えるのか / lambda-power-tuning-side-effects
koukihosaka
2
140
AI x 開発生産性を取り巻く予算戦略と投資対効果
i35_267
7
2.9k
AI工学特論: MLOps・継続的評価
asei
6
1.3k
論語・武士道・産業革命から見る かわるもの、かわらないもの
ichimichi
2
110
伝票作成AIエージェントを支える、LLMOpsとインフラの選択肢 / AICon2026_takeda
rakus_dev
0
260
なぜ、あなたのAPIは使われないのか? AX時代の設計原則、ガードレール、運用体制
yokawasa
1
210
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
450
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
370
Between Models and Reality
mayunak
4
380
[SF Ruby Conf 2025] Rails X
palkan
2
1.2k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
470
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
We Have a Design System, Now What?
morganepeng
55
8.2k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
What's in a price? How to price your products and services
michaelherold
247
13k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
740
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
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