SlideShare a Scribd company logo
3
Most read
12
Most read
14
Most read
Introduction to

 MongoDB
       Raviteja Dodda
Co-Founder, Pipal Tech Ventures

 raviteja@pipaltechventures.com
Twitter, Facebook - @raviteja2007


                                    April 1st, 2012
The Great Divide




MongoDB - Sweet Spot: Easy, Flexible and Scalable
What is MongoDB ?
• Scalable High-Performance Open-source,
Document-orientated database.

• Built for Speed

• Rich Document based queries for Easy readability.

• Full Index Support for High Performance.

• Replication and Failover for High Availability.

• Auto Sharding for Easy Scalability.

• Map / Reduce for Aggregation.
Why use MongoDB?
• SQL was invented in the 70’s to store data.

• MongoDB stores documents (or) objects.

• Now-a-days, everyone works with objects
(Python/Ruby/Java/etc.)

• And we need Databases to persist our objects.
Then why not store objects directly ?

• Embedded documents and arrays reduce need for
joins. No Joins and No-multi document
transactions.
What is MongoDB great for?
• RDBMS replacement for Web Applications.

• Semi-structured Content Management.

• Real-time Analytics & High-Speed Logging.

• Caching and High Scalability

   Web 2.0, Media, SAAS, Gaming
   HealthCare, Finance, Telecom, Government
Not great for?
 • Highly Transactional Applications.

 • Problems requiring SQL.

Some Companies using MongoDB in Production
Let’s Dive in !
When I say                                  Think

 Database                                 Database

• Made up of Multiple Collections.

• Created on-the-fly when referenced for the first time.
When I say                                  Think

Collection                                   Table

• Schema-less, and contains Documents.

• Indexable by one/more keys.

• Created on-the-fly when referenced for the first time.

• Capped Collections: Fixed size, older records get dropped
after reaching the limit.
When I say                               Think

Document                             Record/Row

• Stored in a Collection.

• Can have _id key – works like Primary keys in MySQL.

• Supported Relationships – Embedded (or) References.

• Document storage in BSON (Binary form of JSON).
Understanding the Document Model.
var p = {
‘_id’: ‘3432’,
‘author’: DBRef(‘User’, 2),
‘title’: ‘Introduction to MongoDB’,
‘body’: ‘MongoDB is an open sources.. ‘,
‘timestamp’: Date(’01-04-12’),
‘tags’: [‘MongoDB’, ‘NoSQL’],
‘comments’: [{‘author’: DBRef(‘User’, 4),
                  ‘date’: Date(’02-04-12’),
                  ‘text’: ‘Did you see.. ‘,
                  ‘upvotes’: 7, … ]
}
> db.posts.save(p);
Secondary Indexes
Create Index on any field in the document
// 1 means ascending, -1 means descending
> db.posts.ensureIndex({‘author’: 1});

//Index Nested Documents
> db.posts.ensureIndex(‘comments.author’: 1);

// Index on tags
> db.posts.ensureIndex({‘tags’: 1});

// Geo-spatial Index
> db.posts.ensureIndex({‘author.location’: ‘2d’});
What about Queries? So Simple
// find posts which has ‘MongoDB’ tag.
> db.posts.find({tags: ‘MongoDB’});

// find posts by author’s comments.
> db.posts.find({‘comments.author’:
DBRef(‘User’,2)}).count();

// find posts written after 31st March.
> db.posts.find({‘timestamp’: {‘gte’: Date(’31-03-12’)}});

// find posts written by authors around [22, 42]
> db.posts.find({‘author.location’: {‘near’:[22, 42]});
 $gt, $lt, $gte, $lte, $ne, $all, $in, $nin, count, limit, skip, group, etc…
What about Updates? Atomic Operations makes it simple

db.posts.update({_id: ‘3432’},
{‘title’: ‘Introduction to MongoDB (updated)’,
‘text’: ‘Updated text’,
${addToSet: {‘tags’: ‘webinar’}});


  $set, $unset

 $push, $pull, $pop, $addToSet

 $inc, $decr, many more…



          Where are my joins and transactions? !!!
Some Cool features

• Geo-spatial Indexes for Geo-spatial queries.
   $near, $within_distance, Bound queries (circle, box)

• GridFS
    Stores Large Binary Files.

• Map/Reduce
   GROUP BY in SQL, map/reduce in MongoDB.
Deployment
 & Scaling
Replica Sets
Sharding
How do we use MongoDB at Pipal



Python                         MongoDB

           MongoEngine
       PyMongo based ORM – A Separate Topic !




Btw, Pipal is hiring at Bangalore
Backend Engineers, Frontend Engineers, System-Administrators
Send us your resume at careers@pipaltechventures.com
Questions?

            Next Steps: http://mongodb.org,
                  Twitter: @mongodb

                       Thank You 



Stay Hungry, Stay Foolish !!!
              - Steve Jobs

More Related Content

What's hot (20)

PPTX
Mongodb basics and architecture
Bishal Khanal
 
PPT
Introduction to mongodb
neela madheswari
 
PPTX
Introduction to MongoDB
MongoDB
 
PDF
NOSQL- Presentation on NoSQL
Ramakant Soni
 
PDF
MongoDB Fundamentals
MongoDB
 
PPTX
Mongo db intro.pptx
JWORKS powered by Ordina
 
ODP
Introduction to MongoDB
Dineesha Suraweera
 
PPTX
Hive Tutorial | Hive Architecture | Hive Tutorial For Beginners | Hive In Had...
Simplilearn
 
PDF
An introduction to MongoDB
Universidade de São Paulo
 
PDF
MongodB Internals
Norberto Leite
 
PPTX
introduction to NOSQL Database
nehabsairam
 
PPTX
Mongo DB Presentation
Jaya Naresh Kovela
 
PDF
Nodejs presentation
Arvind Devaraj
 
PPTX
Relational databases vs Non-relational databases
James Serra
 
PPTX
Getting started with postgresql
botsplash.com
 
PPTX
MongoDB 101
Abhijeet Vaikar
 
PPTX
Sql queries presentation
NITISH KUMAR
 
PPTX
Introduction to Redis
Maarten Smeets
 
PPTX
SQL Basics
Hammad Rasheed
 
PPT
Working with Databases and MySQL
Nicole Ryan
 
Mongodb basics and architecture
Bishal Khanal
 
Introduction to mongodb
neela madheswari
 
Introduction to MongoDB
MongoDB
 
NOSQL- Presentation on NoSQL
Ramakant Soni
 
MongoDB Fundamentals
MongoDB
 
Mongo db intro.pptx
JWORKS powered by Ordina
 
Introduction to MongoDB
Dineesha Suraweera
 
Hive Tutorial | Hive Architecture | Hive Tutorial For Beginners | Hive In Had...
Simplilearn
 
An introduction to MongoDB
Universidade de São Paulo
 
MongodB Internals
Norberto Leite
 
introduction to NOSQL Database
nehabsairam
 
Mongo DB Presentation
Jaya Naresh Kovela
 
Nodejs presentation
Arvind Devaraj
 
Relational databases vs Non-relational databases
James Serra
 
Getting started with postgresql
botsplash.com
 
MongoDB 101
Abhijeet Vaikar
 
Sql queries presentation
NITISH KUMAR
 
Introduction to Redis
Maarten Smeets
 
SQL Basics
Hammad Rasheed
 
Working with Databases and MySQL
Nicole Ryan
 

Viewers also liked (11)

PDF
Intro To MongoDB
Alex Sharp
 
PDF
Mongo DB
Edureka!
 
PPTX
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
MongoDB
 
KEY
MongoDB Java Development - MongoBoston 2010
Eliot Horowitz
 
PPTX
Using MongoDB with the .Net Framework
Stefano Paluello
 
PPTX
Webinar: What's new in the .NET Driver
MongoDB
 
PDF
MongoDB@addconf
Sergei Tulentsev
 
PDF
Mongodb
Scott Motte
 
ODP
Кратко о MongoDB
Gleb Lebedev
 
PDF
The Path to Truly Understanding your MongoDB Data
MongoDB
 
PDF
Scalability, Availability & Stability Patterns
Jonas Bonér
 
Intro To MongoDB
Alex Sharp
 
Mongo DB
Edureka!
 
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
MongoDB
 
MongoDB Java Development - MongoBoston 2010
Eliot Horowitz
 
Using MongoDB with the .Net Framework
Stefano Paluello
 
Webinar: What's new in the .NET Driver
MongoDB
 
MongoDB@addconf
Sergei Tulentsev
 
Mongodb
Scott Motte
 
Кратко о MongoDB
Gleb Lebedev
 
The Path to Truly Understanding your MongoDB Data
MongoDB
 
Scalability, Availability & Stability Patterns
Jonas Bonér
 
Ad

Similar to Introduction to MongoDB (20)

PPT
mongodb-120401144140-phpapp01 claud camputing
moeincanada007
 
PPT
Mongodb Training Tutorial in Bangalore
rajkamaltibacademy
 
KEY
Mongodb intro
christkv
 
PPTX
MongoDB by Emroz sardar.
Emroz Sardar
 
PDF
MongoDB
wiTTyMinds1
 
PPT
9. Document Oriented Databases
Fabio Fumarola
 
PDF
MongoDB.pdf
KuldeepKumar778733
 
PPTX
A Presentation on MongoDB Introduction - Habilelabs
HabileLabs
 
PPTX
MongoDB Internals
Siraj Memon
 
PDF
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
NETWAYS
 
KEY
MongoDB
Steven Francia
 
PPTX
Mongodb
ASEEMSRIVASTAVA22
 
PDF
Mongo db transcript
foliba
 
PDF
Quick overview on mongo db
Eman Mohamed
 
PPT
MongoDB Pros and Cons
johnrjenson
 
PPT
Mongo Bb - NoSQL tutorial
Mohan Rathour
 
PPTX
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
PDF
Mongodb
Thiago Veiga
 
PPTX
Einführung in MongoDB
NETUserGroupBern
 
PDF
Using MongoDB and Python
Mike Bright
 
mongodb-120401144140-phpapp01 claud camputing
moeincanada007
 
Mongodb Training Tutorial in Bangalore
rajkamaltibacademy
 
Mongodb intro
christkv
 
MongoDB by Emroz sardar.
Emroz Sardar
 
MongoDB
wiTTyMinds1
 
9. Document Oriented Databases
Fabio Fumarola
 
MongoDB.pdf
KuldeepKumar778733
 
A Presentation on MongoDB Introduction - Habilelabs
HabileLabs
 
MongoDB Internals
Siraj Memon
 
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
NETWAYS
 
Mongo db transcript
foliba
 
Quick overview on mongo db
Eman Mohamed
 
MongoDB Pros and Cons
johnrjenson
 
Mongo Bb - NoSQL tutorial
Mohan Rathour
 
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
Mongodb
Thiago Veiga
 
Einführung in MongoDB
NETUserGroupBern
 
Using MongoDB and Python
Mike Bright
 
Ad

Recently uploaded (20)

PPTX
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PPTX
Essential Content-centric Plugins for your Website
Laura Byrne
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Home Cleaning App Development Services.pdf
V3cube
 
PDF
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
NASA A Researcher’s Guide to International Space Station : Fundamental Physics
Dr. PANKAJ DHUSSA
 
PDF
Software Development Company Keene Systems, Inc (1).pdf
Custom Software Development Company | Keene Systems, Inc.
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Essential Content-centric Plugins for your Website
Laura Byrne
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Home Cleaning App Development Services.pdf
V3cube
 
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
Digital Circuits, important subject in CS
contactparinay1
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
NASA A Researcher’s Guide to International Space Station : Fundamental Physics
Dr. PANKAJ DHUSSA
 
Software Development Company Keene Systems, Inc (1).pdf
Custom Software Development Company | Keene Systems, Inc.
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 

Introduction to MongoDB

  • 1. Introduction to MongoDB Raviteja Dodda Co-Founder, Pipal Tech Ventures [email protected] Twitter, Facebook - @raviteja2007 April 1st, 2012
  • 2. The Great Divide MongoDB - Sweet Spot: Easy, Flexible and Scalable
  • 3. What is MongoDB ? • Scalable High-Performance Open-source, Document-orientated database. • Built for Speed • Rich Document based queries for Easy readability. • Full Index Support for High Performance. • Replication and Failover for High Availability. • Auto Sharding for Easy Scalability. • Map / Reduce for Aggregation.
  • 4. Why use MongoDB? • SQL was invented in the 70’s to store data. • MongoDB stores documents (or) objects. • Now-a-days, everyone works with objects (Python/Ruby/Java/etc.) • And we need Databases to persist our objects. Then why not store objects directly ? • Embedded documents and arrays reduce need for joins. No Joins and No-multi document transactions.
  • 5. What is MongoDB great for? • RDBMS replacement for Web Applications. • Semi-structured Content Management. • Real-time Analytics & High-Speed Logging. • Caching and High Scalability Web 2.0, Media, SAAS, Gaming HealthCare, Finance, Telecom, Government
  • 6. Not great for? • Highly Transactional Applications. • Problems requiring SQL. Some Companies using MongoDB in Production
  • 8. When I say Think Database Database • Made up of Multiple Collections. • Created on-the-fly when referenced for the first time.
  • 9. When I say Think Collection Table • Schema-less, and contains Documents. • Indexable by one/more keys. • Created on-the-fly when referenced for the first time. • Capped Collections: Fixed size, older records get dropped after reaching the limit.
  • 10. When I say Think Document Record/Row • Stored in a Collection. • Can have _id key – works like Primary keys in MySQL. • Supported Relationships – Embedded (or) References. • Document storage in BSON (Binary form of JSON).
  • 11. Understanding the Document Model. var p = { ‘_id’: ‘3432’, ‘author’: DBRef(‘User’, 2), ‘title’: ‘Introduction to MongoDB’, ‘body’: ‘MongoDB is an open sources.. ‘, ‘timestamp’: Date(’01-04-12’), ‘tags’: [‘MongoDB’, ‘NoSQL’], ‘comments’: [{‘author’: DBRef(‘User’, 4), ‘date’: Date(’02-04-12’), ‘text’: ‘Did you see.. ‘, ‘upvotes’: 7, … ] } > db.posts.save(p);
  • 12. Secondary Indexes Create Index on any field in the document // 1 means ascending, -1 means descending > db.posts.ensureIndex({‘author’: 1}); //Index Nested Documents > db.posts.ensureIndex(‘comments.author’: 1); // Index on tags > db.posts.ensureIndex({‘tags’: 1}); // Geo-spatial Index > db.posts.ensureIndex({‘author.location’: ‘2d’});
  • 13. What about Queries? So Simple // find posts which has ‘MongoDB’ tag. > db.posts.find({tags: ‘MongoDB’}); // find posts by author’s comments. > db.posts.find({‘comments.author’: DBRef(‘User’,2)}).count(); // find posts written after 31st March. > db.posts.find({‘timestamp’: {‘gte’: Date(’31-03-12’)}}); // find posts written by authors around [22, 42] > db.posts.find({‘author.location’: {‘near’:[22, 42]}); $gt, $lt, $gte, $lte, $ne, $all, $in, $nin, count, limit, skip, group, etc…
  • 14. What about Updates? Atomic Operations makes it simple db.posts.update({_id: ‘3432’}, {‘title’: ‘Introduction to MongoDB (updated)’, ‘text’: ‘Updated text’, ${addToSet: {‘tags’: ‘webinar’}}); $set, $unset $push, $pull, $pop, $addToSet $inc, $decr, many more… Where are my joins and transactions? !!!
  • 15. Some Cool features • Geo-spatial Indexes for Geo-spatial queries. $near, $within_distance, Bound queries (circle, box) • GridFS Stores Large Binary Files. • Map/Reduce GROUP BY in SQL, map/reduce in MongoDB.
  • 19. How do we use MongoDB at Pipal Python MongoDB MongoEngine PyMongo based ORM – A Separate Topic ! Btw, Pipal is hiring at Bangalore Backend Engineers, Frontend Engineers, System-Administrators Send us your resume at [email protected]
  • 20. Questions? Next Steps: http://mongodb.org, Twitter: @mongodb Thank You  Stay Hungry, Stay Foolish !!! - Steve Jobs