ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Introduction tomongodb
But First, A Little About Me
? My name¡¯s Lee Theobald. Hello!
? Twitter: @Leesy
? Never updated blog:
http://www.ltheobald.co.uk/
? I¡¯m a developer at a small search company
in Cambridge called Open Objects.
Introduction tomongodb
? NoSQL database
? The name is short for humongous
? Open source with development lead by
10Gen (http://www.10gen.com)
? Document Based
? Schema-less
? Highly Scalable
? MapReduce
? Replication & Auto Sharding
Document Store
? Data is stored in the form of JSON data.
{
"_id" : ObjectId("4ccbfc75bd163019417c27f8"),
"title": ¡°Hello World! ",
"author": {
"firstname": "Joe",
"lastname": "Bloggs"
},
"tags": ["test", "foo", "bar"]
}
Familiar Structure
? MongoDB instances contain a number of
databases which in turn contain a number
of collections.
? Think of MySQL with it¡¯s databases &
tables.
? But collections can also be nested. E.g.
? customer_a (Database)
¡ð logs_201009 (Collection)
? top_queries (Collection)
Inserts ¨C Easy As Pie!
use cookbook;
db.desserts.save({
name: "Cherry Pie",
ingredients: ["cherries", "pie"],
cooking_time: 30
});
Searching ¨C A Piece Of Cake
db.recipes.find({
cooking_time: { ¡°$gte¡±: 10, ¡°$lt¡±: 30}
})
db.recipes.findOne()
Some More Advanced Query
Syntax
? Limiting
? db.find().limit(10);
? Skipping
? db.find( ).skip(5);
? Sorting
? db.find({¡­}).sort({cooking_time: ¡°-1¡±});
? Cursors
? var cur = db.find({¡­}).cursor()
? cur.forEach( function(x) { print(tojson(x)) });
MapReduce
? Great way of doing bulk manipulation or
aggregation.
? 2 or 3 functions written in JavaScript that
execute on the server.
? An example use could be generating a list
of top queries from some search logs.
Map Function
? Takes some input of the form of key/value pairs.
? Does something with that
? Returns 0 or more key/value pairs
map = function() {
if (!this.query) {
return;
}
emit (this.query, {count: 1});
}
Reduce Function
? Takes the results from the map function
? Does something (normally combine the results)
? Produces output in key/value pairs
reduce = function(key, values) {
var count = 0;
values.forEach(function(v) {
count += v[¡®count¡¯];
}
return {count: count;}
}
Replica Sets
? Master/Slave configuration
? If your primary server goes down, one of
the secondary ones takes over.
Auto Sharding
But Why Not Try It Yourself
? Download it at: http://www.mongodb.org
? Online tutorial
at:http://www.mongodb.org/display/DOCS
/Tutorial
? Some handy MongoDB sites:
? MongoDB Cookbook:
http://cookbook.mongodb.org/
? Kyle Banker¡¯s blog:
http://kylebanker.com/blog/
Introduction tomongodb
Ad

Recommended

Do something in 5 minutes with gas 1-use spreadsheet as database
Do something in 5 minutes with gas 1-use spreadsheet as database
Bruce McPherson
?
Do something in 5 with gas 3-simple invoicing app
Do something in 5 with gas 3-simple invoicing app
Bruce McPherson
?
Do something in 5 with gas 7-email log
Do something in 5 with gas 7-email log
Bruce McPherson
?
Do something in 5 with gas 2-graduate to a database
Do something in 5 with gas 2-graduate to a database
Bruce McPherson
?
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Bruce McPherson
?
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Bruce McPherson
?
JavaScript client API for Google Apps Script API primer
JavaScript client API for Google Apps Script API primer
Bruce McPherson
?
Do something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databases
Bruce McPherson
?
MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011
Chris Westin
?
Xadoop - new approaches to data analytics
Xadoop - new approaches to data analytics
Maxim Grinev
?
Introducing CouchDB
Introducing CouchDB
Hatem Ben Yacoub
?
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
Peter Friese
?
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Outlyer
?
Database c# connetion
Database c# connetion
Christofer Toledo
?
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Modern Data Stack France
?
Operations on rdd
Operations on rdd
sparrowAnalytics.com
?
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascript
Changhwan Yi
?
[4DEV][?¨®d?] Ivan Vaskevych - InfluxDB and Grafana fighting together with IoT...
[4DEV][?¨®d?] Ivan Vaskevych - InfluxDB and Grafana fighting together with IoT...
PROIDEA
?
Building data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemy
Roger Barnes
?
From Overnight to Always On @ Jfokus 2019
From Overnight to Always On @ Jfokus 2019
Enno Runne
?
A Beginner's Guide to Building Data Pipelines with Luigi
A Beginner's Guide to Building Data Pipelines with Luigi
Growth Intelligence
?
VBA API for scriptDB primer
VBA API for scriptDB primer
Bruce McPherson
?
Reactive Extensions (Rx)
Reactive Extensions (Rx)
Mark Allan
?
¤Ê¤ó¤Ç¤â±õ¶Ù
¤Ê¤ó¤Ç¤â±õ¶Ù
kwatch
?
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
Simon Su
?
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov
Yulia Shcherbachova
?
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Rick Copeland
?
AJUG April 2011 Raw hadoop example
AJUG April 2011 Raw hadoop example
Christopher Curtin
?
Introduction To MongoDB
Introduction To MongoDB
Lee Theobald
?
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
Lee Theobald
?

More Related Content

What's hot (20)

MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011
Chris Westin
?
Xadoop - new approaches to data analytics
Xadoop - new approaches to data analytics
Maxim Grinev
?
Introducing CouchDB
Introducing CouchDB
Hatem Ben Yacoub
?
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
Peter Friese
?
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Outlyer
?
Database c# connetion
Database c# connetion
Christofer Toledo
?
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Modern Data Stack France
?
Operations on rdd
Operations on rdd
sparrowAnalytics.com
?
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascript
Changhwan Yi
?
[4DEV][?¨®d?] Ivan Vaskevych - InfluxDB and Grafana fighting together with IoT...
[4DEV][?¨®d?] Ivan Vaskevych - InfluxDB and Grafana fighting together with IoT...
PROIDEA
?
Building data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemy
Roger Barnes
?
From Overnight to Always On @ Jfokus 2019
From Overnight to Always On @ Jfokus 2019
Enno Runne
?
A Beginner's Guide to Building Data Pipelines with Luigi
A Beginner's Guide to Building Data Pipelines with Luigi
Growth Intelligence
?
VBA API for scriptDB primer
VBA API for scriptDB primer
Bruce McPherson
?
Reactive Extensions (Rx)
Reactive Extensions (Rx)
Mark Allan
?
¤Ê¤ó¤Ç¤â±õ¶Ù
¤Ê¤ó¤Ç¤â±õ¶Ù
kwatch
?
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
Simon Su
?
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov
Yulia Shcherbachova
?
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Rick Copeland
?
AJUG April 2011 Raw hadoop example
AJUG April 2011 Raw hadoop example
Christopher Curtin
?
MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011
Chris Westin
?
Xadoop - new approaches to data analytics
Xadoop - new approaches to data analytics
Maxim Grinev
?
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
Peter Friese
?
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Outlyer
?
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Modern Data Stack France
?
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascript
Changhwan Yi
?
[4DEV][?¨®d?] Ivan Vaskevych - InfluxDB and Grafana fighting together with IoT...
[4DEV][?¨®d?] Ivan Vaskevych - InfluxDB and Grafana fighting together with IoT...
PROIDEA
?
Building data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemy
Roger Barnes
?
From Overnight to Always On @ Jfokus 2019
From Overnight to Always On @ Jfokus 2019
Enno Runne
?
A Beginner's Guide to Building Data Pipelines with Luigi
A Beginner's Guide to Building Data Pipelines with Luigi
Growth Intelligence
?
VBA API for scriptDB primer
VBA API for scriptDB primer
Bruce McPherson
?
Reactive Extensions (Rx)
Reactive Extensions (Rx)
Mark Allan
?
¤Ê¤ó¤Ç¤â±õ¶Ù
¤Ê¤ó¤Ç¤â±õ¶Ù
kwatch
?
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
Simon Su
?
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov
Yulia Shcherbachova
?
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Rick Copeland
?
AJUG April 2011 Raw hadoop example
AJUG April 2011 Raw hadoop example
Christopher Curtin
?

Viewers also liked (16)

Introduction To MongoDB
Introduction To MongoDB
Lee Theobald
?
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
Lee Theobald
?
MongoDB Administration 101
MongoDB Administration 101
MongoDB
?
MongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB
?
»ùÓڱʲâ³Ù³ó´Ç²Ô¹¹½¨¿ÉÀ©Õ¹µÄ×Ô¶¯»¯ÔËάƽ̨
»ùÓڱʲâ³Ù³ó´Ç²Ô¹¹½¨¿ÉÀ©Õ¹µÄ×Ô¶¯»¯ÔËάƽ̨
liuts
?
Maximizing MongoDB Performance on AWS
Maximizing MongoDB Performance on AWS
MongoDB
?
How Thermo Fisher Is Reducing Mass Spectrometry Experiment Times from Days to...
How Thermo Fisher Is Reducing Mass Spectrometry Experiment Times from Days to...
MongoDB
?
MongoDB Europe 2016 - Welcome
MongoDB Europe 2016 - Welcome
MongoDB
?
Big Data Spain 2016: Keynote
Big Data Spain 2016: Keynote
MongoDB
?
MongoDB World 2016: Poster Sessions eBook
MongoDB World 2016: Poster Sessions eBook
MongoDB
?
How Auto Trader enables the UK's largest digital automotive marketplace
How Auto Trader enables the UK's largest digital automotive marketplace
MongoDB
?
Webinar: Transitioning from SQL to MongoDB
Webinar: Transitioning from SQL to MongoDB
MongoDB
?
Creating a Modern Data Architecture for Digital Transformation
Creating a Modern Data Architecture for Digital Transformation
MongoDB
?
Seminario Web MongoDB-Paradigma: Cree aplicaciones m¨¢s escalables utilizando ...
MongoDB
?
Webinar: 10-Step Guide to Creating a Single View of your Business
Webinar: 10-Step Guide to Creating a Single View of your Business
MongoDB
?
ºÝºÝߣShare 101
ºÝºÝߣShare 101
Amit Ranjan
?
Introduction To MongoDB
Introduction To MongoDB
Lee Theobald
?
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
Lee Theobald
?
MongoDB Administration 101
MongoDB Administration 101
MongoDB
?
MongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB
?
»ùÓڱʲâ³Ù³ó´Ç²Ô¹¹½¨¿ÉÀ©Õ¹µÄ×Ô¶¯»¯ÔËάƽ̨
»ùÓڱʲâ³Ù³ó´Ç²Ô¹¹½¨¿ÉÀ©Õ¹µÄ×Ô¶¯»¯ÔËάƽ̨
liuts
?
Maximizing MongoDB Performance on AWS
Maximizing MongoDB Performance on AWS
MongoDB
?
How Thermo Fisher Is Reducing Mass Spectrometry Experiment Times from Days to...
How Thermo Fisher Is Reducing Mass Spectrometry Experiment Times from Days to...
MongoDB
?
MongoDB Europe 2016 - Welcome
MongoDB Europe 2016 - Welcome
MongoDB
?
Big Data Spain 2016: Keynote
Big Data Spain 2016: Keynote
MongoDB
?
MongoDB World 2016: Poster Sessions eBook
MongoDB World 2016: Poster Sessions eBook
MongoDB
?
How Auto Trader enables the UK's largest digital automotive marketplace
How Auto Trader enables the UK's largest digital automotive marketplace
MongoDB
?
Webinar: Transitioning from SQL to MongoDB
Webinar: Transitioning from SQL to MongoDB
MongoDB
?
Creating a Modern Data Architecture for Digital Transformation
Creating a Modern Data Architecture for Digital Transformation
MongoDB
?
Seminario Web MongoDB-Paradigma: Cree aplicaciones m¨¢s escalables utilizando ...
MongoDB
?
Webinar: 10-Step Guide to Creating a Single View of your Business
Webinar: 10-Step Guide to Creating a Single View of your Business
MongoDB
?
ºÝºÝߣShare 101
ºÝºÝߣShare 101
Amit Ranjan
?
Ad

Similar to Introduction tomongodb (20)

Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
MongoDB
?
Introduction to MongoDB and Workshop
Introduction to MongoDB and Workshop
AhmedabadJavaMeetup
?
MongoDB - Introduction
MongoDB - Introduction
Vagmi Mudumbai
?
9. Document Oriented Databases
9. Document Oriented Databases
Fabio Fumarola
?
MongoDB.pdf
MongoDB.pdf
KuldeepKumar778733
?
introtomongodb
introtomongodb
saikiran
?
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
NETWAYS
?
MongoDB
MongoDB
Steven Francia
?
Mongodb intro
Mongodb intro
christkv
?
MongoDB - A Document NoSQL Database
MongoDB - A Document NoSQL Database
Ruben Inoto Soto
?
Building Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata Catalog
hungarianhc
?
Data as Documents: Overview and intro to MongoDB
Data as Documents: Overview and intro to MongoDB
Mitch Pirtle
?
MongoDB by Emroz sardar.
MongoDB by Emroz sardar.
Emroz Sardar
?
Talk MongoDB - Amil
Talk MongoDB - Amil
removed_b0e2342824f6227286f54ba461ebc0fe
?
MongoDB at CodeMash 2.0.1.0
MongoDB at CodeMash 2.0.1.0
Mike Dirolf
?
MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overview
Antonio Pintus
?
MongoDB is a document database. It stores data in a type of JSON format calle...
MongoDB is a document database. It stores data in a type of JSON format calle...
amintafernandos
?
Mongoskin - Guilin
Mongoskin - Guilin
Jackson Tian
?
Building Apps with MongoDB
Building Apps with MongoDB
Nate Abele
?
Mongo DB
Mongo DB
SRM University Delhi-NCR sonepat
?
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
MongoDB
?
Introduction to MongoDB and Workshop
Introduction to MongoDB and Workshop
AhmedabadJavaMeetup
?
9. Document Oriented Databases
9. Document Oriented Databases
Fabio Fumarola
?
introtomongodb
introtomongodb
saikiran
?
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
NETWAYS
?
Mongodb intro
Mongodb intro
christkv
?
MongoDB - A Document NoSQL Database
MongoDB - A Document NoSQL Database
Ruben Inoto Soto
?
Building Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata Catalog
hungarianhc
?
Data as Documents: Overview and intro to MongoDB
Data as Documents: Overview and intro to MongoDB
Mitch Pirtle
?
MongoDB by Emroz sardar.
MongoDB by Emroz sardar.
Emroz Sardar
?
MongoDB at CodeMash 2.0.1.0
MongoDB at CodeMash 2.0.1.0
Mike Dirolf
?
MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overview
Antonio Pintus
?
MongoDB is a document database. It stores data in a type of JSON format calle...
MongoDB is a document database. It stores data in a type of JSON format calle...
amintafernandos
?
Building Apps with MongoDB
Building Apps with MongoDB
Nate Abele
?
Ad

Introduction tomongodb

  • 2. But First, A Little About Me ? My name¡¯s Lee Theobald. Hello! ? Twitter: @Leesy ? Never updated blog: http://www.ltheobald.co.uk/ ? I¡¯m a developer at a small search company in Cambridge called Open Objects.
  • 4. ? NoSQL database ? The name is short for humongous ? Open source with development lead by 10Gen (http://www.10gen.com) ? Document Based ? Schema-less ? Highly Scalable ? MapReduce ? Replication & Auto Sharding
  • 5. Document Store ? Data is stored in the form of JSON data. { "_id" : ObjectId("4ccbfc75bd163019417c27f8"), "title": ¡°Hello World! ", "author": { "firstname": "Joe", "lastname": "Bloggs" }, "tags": ["test", "foo", "bar"] }
  • 6. Familiar Structure ? MongoDB instances contain a number of databases which in turn contain a number of collections. ? Think of MySQL with it¡¯s databases & tables. ? But collections can also be nested. E.g. ? customer_a (Database) ¡ð logs_201009 (Collection) ? top_queries (Collection)
  • 7. Inserts ¨C Easy As Pie! use cookbook; db.desserts.save({ name: "Cherry Pie", ingredients: ["cherries", "pie"], cooking_time: 30 });
  • 8. Searching ¨C A Piece Of Cake db.recipes.find({ cooking_time: { ¡°$gte¡±: 10, ¡°$lt¡±: 30} }) db.recipes.findOne()
  • 9. Some More Advanced Query Syntax ? Limiting ? db.find().limit(10); ? Skipping ? db.find( ).skip(5); ? Sorting ? db.find({¡­}).sort({cooking_time: ¡°-1¡±}); ? Cursors ? var cur = db.find({¡­}).cursor() ? cur.forEach( function(x) { print(tojson(x)) });
  • 10. MapReduce ? Great way of doing bulk manipulation or aggregation. ? 2 or 3 functions written in JavaScript that execute on the server. ? An example use could be generating a list of top queries from some search logs.
  • 11. Map Function ? Takes some input of the form of key/value pairs. ? Does something with that ? Returns 0 or more key/value pairs map = function() { if (!this.query) { return; } emit (this.query, {count: 1}); }
  • 12. Reduce Function ? Takes the results from the map function ? Does something (normally combine the results) ? Produces output in key/value pairs reduce = function(key, values) { var count = 0; values.forEach(function(v) { count += v[¡®count¡¯]; } return {count: count;} }
  • 13. Replica Sets ? Master/Slave configuration ? If your primary server goes down, one of the secondary ones takes over.
  • 15. But Why Not Try It Yourself ? Download it at: http://www.mongodb.org ? Online tutorial at:http://www.mongodb.org/display/DOCS /Tutorial ? Some handy MongoDB sites: ? MongoDB Cookbook: http://cookbook.mongodb.org/ ? Kyle Banker¡¯s blog: http://kylebanker.com/blog/