Presentation: Intro to MongoDB by Alex Sharp
We’ve never got enough introductions to NoSQL systems. Embedded below are the slides from Alex Sharp’s (@ajsharp): Intro to MongoDB presentation. Just to allow you quick overview, you can find below also the text only version.
Text-only version of Intro to MongoDB
-
Slide: 1
Intro to MongoDB
Alex Sharp
twitter: @ajsharp
-
Slide: 2
So what is MongoDB?
-
Slide: 3
First and foremost…
-
Slide: 4
IT’S THE NEW HOTNESS!!!
-
Slide: 5
omgomgomg
SHINY OBJECTS
omgomgomg
-
Slide: 6
MongoDB (from “humongous”) is a scalable, high-performance, open source, schema-free, document-oriented database.
- mongodb.org
-
Slide: 7
Philosophy
-
Slide: 8
Philosophy
“One size fits all” approach no longer applies
-
Slide: 9
Philosophy
Non-relational DBs scale more easily, especially horizontally
-
Slide: 10
Philosophy
Focus on speed, performance, flexibility and scalability
-
Slide: 11
Philosophy
Not concerned with transactional stuff and relational semantics
-
Slide: 12
Philosophy
DBs should be an on-demand commodity, in a cloud-like fashion
-
Slide: 13
Philosophy
Mongo tries to achieve the performance of traditional key-value stores while maintaining functionality of traditional RDBMS
-
Slide: 14
Features
-
Slide: 15
Features
Standard database stuff
-
Slide: 16
Features
Standard database stuff
Indexing
-
Slide: 17
Features
Standard database stuff
Indexing
replication/failover support
-
Slide: 18
Features: Document Storage
Documents are stored in BSON (binary JSON)
-
Slide: 19
BSON is a binary serialization of JSON-like objects
Features: Document Storage
-
Slide: 20
Features: Document Storage
This is extremely powerful, b/c it means mongo understands JSON natively
-
Slide: 21
Features: Document Storage
Any valid JSON can be easily imported and queried
-
Slide: 22
Features
Schema-less; very flexible
-
Slide: 23
Features
Schema-less; very flexible
no more blocking ALTER TABLE
-
Slide: 24
Features
Auto-sharding (alpha)
-
Slide: 25
Features
Makes for easy horizontal scaling
-
Slide: 26
Features
Map/Reduce
-
Slide: 27
Features
Very, very fast
-
Slide: 28
Features
Super easy to install
-
Slide: 29
Features
Strong with major languages
-
Slide: 30
Features
Document-oriented = flexible
-
Slide: 31
Features: Querying
Rich, javascript-based query syntax
-
Slide: 32
Features: Querying
Rich, javascript-based query syntax
Allows us to deep, nested queries
-
Slide: 33
Features: Querying
Rich, javascript-based query syntax
Allows us to do deep, nested queries
db.order.find( { shipping: { carrier: "usps" } } ); -
Slide: 34
Features: Querying
Rich, javascript-based query syntax
Allows us to deep, nested queries
db.order.find( { shipping: { carrier: "usps" } } );shipping is an embedded document (object)
-
Slide: 35
Features: Binary Object Store
Efficient binary large object store via GridFS
-
Slide: 36
Features: Binary Object Store
Efficient binary large object store via GridFS
i.e. store images, videos, anything
-
Slide: 37
Concepts
-
Slide: 38
Concepts: Document-oriented
Think of “documents” as database records
-
Slide: 39
Concepts: Document-oriented
Think of “documents” as database records
Documents are basically just JSON objects that Mongo stores in binary
-
Slide: 40
Concepts: Document-oriented
Think of “collections” as database tables
-
Slide: 44
Concept Mapping
RDBMS (mysql, postgres)
Tables
Records/rows
Queries return record(s)
MongoDB
Collections
Documents/objects
Queries return a cursor
???
-
Slide: 45
Concepts: Cursors
Queries return “cursors” instead of collections
-
Slide: 46
Concepts: Cursors
Queries return “cursors” instead of collections
A cursor allows you to iterate through the result set
-
Slide: 47
Concepts: Cursors
Queries return “cursors” instead of collections
A cursor allows you to iterate through the result set
A big reason for this is performance
-
Slide: 48
Concepts: Cursors
Queries return “cursors” instead of collections
A cursor allows you to iterate through the result set
A big reason for this is performance
Much more efficient than loading all objects into memory
-
Slide: 49
Concepts: Cursors
The
find()function returns a cursor object -
Slide: 50
Concepts: Cursors
The
find()function returns a cursor objectvar cursor = db.logged_requests.find({ 'status_code' : 200 })cursor.hasNext() // "true"cursor.forEach( function (item) {print(tojson(item))});cursor.hasNext() // "false" -
Slide: 51
Cool Features
-
Slide: 52
Cool Features
Capped collections
-
Slide: 53
Cool Features
Capped collections
Fixed-sized, limited operation, auto-LRU age-out collections
-
Slide: 54
Cool Features
Capped collections
Fixed-sized, limited operation, auto-LRU age-out collections
Fixed insertion order
-
Slide: 55
Cool Features
Capped collections
Fixed-sized, limited operation, auto-LRU age-out collections
Fixed insertion order
Super fast
-
Slide: 56
Cool Features
Capped collections
Fixed-sized, limited operation, auto-LRU age-out collections
Fixed insertion order
Super fast
Ideal for logging and caching
-
Slide: 57
Cool Uses
Data Warehouse
Mongo understands JSON natively
-
Slide: 58
Cool Uses
Data Warehouse
Mongo understands JSON natively
Very powerful for analysis
-
Slide: 59
Cool Uses
Data Warehouse
Mongo understands JSON natively
Very powerful for analysis
Query a bunch of data from some web service
-
Slide: 60
Cool Uses
Data Warehouse
Mongo understands JSON natively
Very powerful for analysis
Query a bunch of data from some web service
Import into mongo (mongoimport -f filename.json)
-
Slide: 61
Cool Uses
Data Warehouse
Mongo understands JSON natively
Very powerful for analysis
Query a bunch of data from some web service
Import into mongo (mongoimport -f filename.json)
Analyze to your heart’s content
-
Slide: 62
Cool Uses
Harmonyapp.com
Large rails app for building websites (kind of a CMS)
-
Slide: 63
Cool Uses
Hardcore debugging
Spit out large amounts of data
-
Slide: 64
Limitations
Transaction support
-
Slide: 65
Limitations
Transaction support
Relational integrity
-
Slide: 66
Resources

