SlideShare a Scribd company logo
1 of 20
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)

Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
NoSql
NoSqlNoSql
NoSql
 
Hadoop File system (HDFS)
Hadoop File system (HDFS)Hadoop File system (HDFS)
Hadoop File system (HDFS)
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mongodb
MongodbMongodb
Mongodb
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
introduction to NOSQL Database
introduction to NOSQL Databaseintroduction to NOSQL Database
introduction to NOSQL Database
 
Nosql databases
Nosql databasesNosql databases
Nosql databases
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Key-Value NoSQL Database
Key-Value NoSQL DatabaseKey-Value NoSQL Database
Key-Value NoSQL Database
 
NOSQL Databases types and Uses
NOSQL Databases types and UsesNOSQL Databases types and Uses
NOSQL Databases types and Uses
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
Mongo db intro.pptx
Mongo db intro.pptxMongo db intro.pptx
Mongo db intro.pptx
 
Polyglot Persistence
Polyglot Persistence Polyglot Persistence
Polyglot Persistence
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 

Viewers also liked

Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDBAlex Sharp
 
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)MongoDB
 
MongoDB Java Development - MongoBoston 2010
MongoDB Java Development - MongoBoston 2010MongoDB Java Development - MongoBoston 2010
MongoDB Java Development - MongoBoston 2010Eliot Horowitz
 
Using MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkUsing MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkStefano Paluello
 
Webinar: What's new in the .NET Driver
Webinar: What's new in the .NET DriverWebinar: What's new in the .NET Driver
Webinar: What's new in the .NET DriverMongoDB
 
Кратко о MongoDB
Кратко о MongoDBКратко о MongoDB
Кратко о MongoDBGleb Lebedev
 
The Path to Truly Understanding your MongoDB Data
The Path to Truly Understanding your MongoDB DataThe Path to Truly Understanding your MongoDB Data
The Path to Truly Understanding your MongoDB DataMongoDB
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsJonas Bonér
 

Viewers also liked (11)

Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDB
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
 
MongoDB Java Development - MongoBoston 2010
MongoDB Java Development - MongoBoston 2010MongoDB Java Development - MongoBoston 2010
MongoDB Java Development - MongoBoston 2010
 
Using MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkUsing MongoDB with the .Net Framework
Using MongoDB with the .Net Framework
 
Webinar: What's new in the .NET Driver
Webinar: What's new in the .NET DriverWebinar: What's new in the .NET Driver
Webinar: What's new in the .NET Driver
 
MongoDB@addconf
MongoDB@addconfMongoDB@addconf
MongoDB@addconf
 
Mongodb
MongodbMongodb
Mongodb
 
Кратко о MongoDB
Кратко о MongoDBКратко о MongoDB
Кратко о MongoDB
 
The Path to Truly Understanding your MongoDB Data
The Path to Truly Understanding your MongoDB DataThe Path to Truly Understanding your MongoDB Data
The Path to Truly Understanding your MongoDB Data
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 

Similar to Introduction to MongoDB

mongodb-120401144140-phpapp01 claud camputing
mongodb-120401144140-phpapp01 claud camputingmongodb-120401144140-phpapp01 claud camputing
mongodb-120401144140-phpapp01 claud camputingmoeincanada007
 
MongoDB by Emroz sardar.
MongoDB by Emroz sardar.MongoDB by Emroz sardar.
MongoDB by Emroz sardar.Emroz Sardar
 
Mongodb Training Tutorial in Bangalore
Mongodb Training Tutorial in BangaloreMongodb Training Tutorial in Bangalore
Mongodb Training Tutorial in Bangalorerajkamaltibacademy
 
MongoDB 2.4 and spring data
MongoDB 2.4 and spring dataMongoDB 2.4 and spring data
MongoDB 2.4 and spring dataJimmy Ray
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDBNorberto Leite
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBMongoDB
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCupWebGeek Philippines
 
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyOSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyNETWAYS
 
Mongo db first steps with csharp
Mongo db first steps with csharpMongo db first steps with csharp
Mongo db first steps with csharpSerdar Buyuktemiz
 
Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answersjeetendra mandal
 
Mongodb intro
Mongodb introMongodb intro
Mongodb introchristkv
 
Everything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptxEverything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptx75waytechnologies
 
When to Use MongoDB
When to Use MongoDBWhen to Use MongoDB
When to Use MongoDBMongoDB
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Consjohnrjenson
 
Mongodb open data day 2014
Mongodb open data day 2014Mongodb open data day 2014
Mongodb open data day 2014David Green
 

Similar to Introduction to MongoDB (20)

mongodb-120401144140-phpapp01 claud camputing
mongodb-120401144140-phpapp01 claud camputingmongodb-120401144140-phpapp01 claud camputing
mongodb-120401144140-phpapp01 claud camputing
 
MongoDB by Emroz sardar.
MongoDB by Emroz sardar.MongoDB by Emroz sardar.
MongoDB by Emroz sardar.
 
Mongodb Training Tutorial in Bangalore
Mongodb Training Tutorial in BangaloreMongodb Training Tutorial in Bangalore
Mongodb Training Tutorial in Bangalore
 
MongoDB 2.4 and spring data
MongoDB 2.4 and spring dataMongoDB 2.4 and spring data
MongoDB 2.4 and spring data
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongodb
MongodbMongodb
Mongodb
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup
 
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyOSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
 
Mongo db first steps with csharp
Mongo db first steps with csharpMongo db first steps with csharp
Mongo db first steps with csharp
 
Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answers
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
Everything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptxEverything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptx
 
When to Use MongoDB
When to Use MongoDBWhen to Use MongoDB
When to Use MongoDB
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Cons
 
Mongodb open data day 2014
Mongodb open data day 2014Mongodb open data day 2014
Mongodb open data day 2014
 
Introduction to Mongodb
Introduction to MongodbIntroduction to Mongodb
Introduction to Mongodb
 

Recently uploaded

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Introduction to MongoDB

  • 1. Introduction to MongoDB Raviteja Dodda Co-Founder, Pipal Tech Ventures raviteja@pipaltechventures.com 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 careers@pipaltechventures.com
  • 20. Questions? Next Steps: http://mongodb.org, Twitter: @mongodb Thank You  Stay Hungry, Stay Foolish !!! - Steve Jobs