SlideShare a Scribd company logo
By : Sudhir Patil
@spatilTweet
I will talk ….
•What is MongoDB ?
•Queries in MongoDB
•Replication
•Sharding
•Other Cool Features
•Code samples
•Performance
• When to Use & not Use?
What is MongoDB?
•Document-oriented
•JSON-style documents (Actually BSON)
•Dynamic Schema
•Non Relational (NOSQL)
•Performance
•Written in C++ for high
•Full Index support
•No Transactions (but supports atomic operations)
•Not relational
•Scalability
•Replication
•Shardinges
Who is using MongoDB?
See more @ http://www.mongodb.org/display/DOCS/Production+Deployments
Document Oriented??
You can store and access data in real life document style.
- Can have any number of fields.
- Can contain other documents(comments in below example)
- Can store array/collection elements (e.g tags)
- Not restricted to strict columns and rows. Document can con
For RDBMS people, its denormalized view by combining multiple tables relational
databases.
{
“title”: “NoSQL Database Internals”,
“date”: “Tue Oct 27 2009 17:24:18 GMT-0400 (EDT)”,
“content” : “ Database internals …….”,
“author” : “xxxxxx” ,
“tags”: [“nosql”, “databases”, “c++”],
“comments”: [
{“author”: “Fred”,
“text”: “Quite”
}
]
}
How to access/query data?
db.post.find() ➔ SELECT * FROM post
db.posts.find({“author”:“Kyle”})
db.posts.find(“tags”: “nosql”)
db.posts.find({“date”: {“$lte”: Date.now})
db.post.find({“comments.username”: “eh”})
Insert/Update/Alter?
Insert
db.user.insert({‘name’ : ‘foobar’, ‘age’ : 25}) ➔
INSERT INTO user (`name`, `age`) values ('foobar',25)
Update
db.user.update({'name' : 'foobar'}, {$set : {'age' : 36}}) ➔
UPDATE user SET `age` = 36 WHERE `name` = 'foobar‘
if you want add a column `email`
db.user.insert({‘name’ : ‘foobar’, ‘age’ : 25, ‘email’ : ‘foo@bar.com’}) ➔
ALTER TABLE user….
Delete
db.user.remove({'age' : {$lt : 30}}) ➔ DELETE FROM user WHERE age <
30
But why should i use instead of
RDBS(say mysql)?
● If you got huge data, thats difficult to manage in RDBMS, without lot of
firefight.
● Dynamic schema, application can add new fields just by adding fields
in Object mapping collection(table).
● Faster development, as you don’t need alter table scripts and don’t
need to split your data into columns.
● Easier to scale and shard.
● New shiny thing?
DriversDrivers / Libraries
•All most all Famous languages have drivers for mongodb. More details @
http://www.mongodb.org/display/DOCS/Drivers
•OR M (Object relational mappers)
o Java - morphia, spring data
o Ruby - mongoid, mongoMapper
o Php - doctrine, mongodloid
o node.js - Mongoose.
Features: Replication
•Master-Slave Replication
•Replica Pairs
Features : Sharding
Other Cool Features
• Grid FS
• Store files of any size
• GridFS will leverage any existing replication or autosharding that you’ve set up for
MongoDB, so getting failover and scale-out for file
•Map Reduce
•Queries run in all shards parallel
•Flexible aggregation and data processing
•Geospatial Indexing
•Find objects based on location – Find closest n items to x
e.g
db.map.insert({location : {longitude : -40, latitude : 78}})
db.map.find({location : {$near : [ -30, 70]})
Performance
Source: http://www.idiotsabound.com/did-i-mention-mongodb-is-fast-way-to-go-mongo
|+-------------------------------------------------------------------------+|
**** 100000 Indexed Queries ****
|+-------------------------------------------------------------------------+|
| Average | Median | Deviation | Lap Total | Total |
+-------------------------------------------------------------------------+
| MongoDb | 0.00025 | 0.00021 | 0.00019 | 24.99955 | 29.138463 |
| CouchDb | 0.01098 | 0.01067 | 0.00972 | 1097.85109 | 1101.09003 |
| MysqlDb | 0.00199 | 0.00032 | 0.00518 | 199.32546 | 201.88513 |
+---------------------------------------------------------------------------+
Source: http://www.michaelckennedy.net/blog/2010/04/29/MongoDBVsSQLServer2008PerformanceShowdown.aspx
Performance
Code Samples : Music Band
Band
Contact Info
Distributor
Song
1
10….
*
0….
*
When Not to use it / Drawbacks?
• If your data is not huge and comfortably fits in RDBMS
• If you need transactional features.
• If you have complex Relationships.
• Learning curve, querying etc is not hard in mongo but
almost everyone knows SQL syntax.
• Global write lock.
• Duplicate data and data integrity as same piece of data
may be embedded in multiple documents.
• You have to manage any relationships at application layer.
Nuggets
• Consider it only when your data is huge or doesn’t really
suit relational structure.
• Very easy & enjoyable at development phase but as
application grows data stored might get messy. So store
and retrieve data using ORM objects only and be careful
while changing object fields e.g renaming.
• Relationships ,constraints, integrity etc have to be
managed at application level, unlike RDBMS where all
these are built in.
• Don’t stuff everything in single document, use references to
other documents when appropriate.
• Querying is not hard but takes some time to get used to it,
so not easy as querying in SQL.
Thank You!

More Related Content

What's hot (20)

MongoDB Hadoop DC
MongoDB Hadoop DCMongoDB Hadoop DC
MongoDB Hadoop DC
Mike Dirolf
 
Mongo Seattle - The Business of MongoDB
Mongo Seattle - The Business of MongoDBMongo Seattle - The Business of MongoDB
Mongo Seattle - The Business of MongoDB
Justin Smestad
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
César Trigo
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
neela madheswari
 
MongoDB SF Python
MongoDB SF PythonMongoDB SF Python
MongoDB SF Python
Mike Dirolf
 
CouchDB: replicated data store for distributed proxy server
CouchDB: replicated data store for distributed proxy serverCouchDB: replicated data store for distributed proxy server
CouchDB: replicated data store for distributed proxy server
tkramar
 
Introduction to MongoDB and CRUD operations
Introduction to MongoDB and CRUD operationsIntroduction to MongoDB and CRUD operations
Introduction to MongoDB and CRUD operations
Anand Kumar
 
MongoDb - Details on the POC
MongoDb - Details on the POCMongoDb - Details on the POC
MongoDb - Details on the POC
Amardeep Vishwakarma
 
Back to Basics 2017 - Introduction to NoSQL
Back to Basics 2017 - Introduction to NoSQLBack to Basics 2017 - Introduction to NoSQL
Back to Basics 2017 - Introduction to NoSQL
Joe Drumgoole
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
HabileLabs
 
10 mongo db
10 mongo db10 mongo db
10 mongo db
Ahmed Elbassel
 
Part One: Building Web Apps with the MERN Stack
Part One: Building Web Apps with the MERN StackPart One: Building Web Apps with the MERN Stack
Part One: Building Web Apps with the MERN Stack
MongoDB
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - Habilelabs
HabileLabs
 
Redis
RedisRedis
Redis
Ramon Wartala
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
NexThoughts Technologies
 
Mongo db transcript
Mongo db transcriptMongo db transcript
Mongo db transcript
foliba
 
Mongodb
MongodbMongodb
Mongodb
foliba
 
Redis Overview
Redis OverviewRedis Overview
Redis Overview
Hoang Long
 
Introduction to mongoDB
Introduction to mongoDBIntroduction to mongoDB
Introduction to mongoDB
Cuelogic Technologies Pvt. Ltd.
 
MongoDB - Getting Started
MongoDB  - Getting StartedMongoDB  - Getting Started
MongoDB - Getting Started
Ahmed Helmy
 
MongoDB Hadoop DC
MongoDB Hadoop DCMongoDB Hadoop DC
MongoDB Hadoop DC
Mike Dirolf
 
Mongo Seattle - The Business of MongoDB
Mongo Seattle - The Business of MongoDBMongo Seattle - The Business of MongoDB
Mongo Seattle - The Business of MongoDB
Justin Smestad
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
César Trigo
 
MongoDB SF Python
MongoDB SF PythonMongoDB SF Python
MongoDB SF Python
Mike Dirolf
 
CouchDB: replicated data store for distributed proxy server
CouchDB: replicated data store for distributed proxy serverCouchDB: replicated data store for distributed proxy server
CouchDB: replicated data store for distributed proxy server
tkramar
 
Introduction to MongoDB and CRUD operations
Introduction to MongoDB and CRUD operationsIntroduction to MongoDB and CRUD operations
Introduction to MongoDB and CRUD operations
Anand Kumar
 
Back to Basics 2017 - Introduction to NoSQL
Back to Basics 2017 - Introduction to NoSQLBack to Basics 2017 - Introduction to NoSQL
Back to Basics 2017 - Introduction to NoSQL
Joe Drumgoole
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
HabileLabs
 
Part One: Building Web Apps with the MERN Stack
Part One: Building Web Apps with the MERN StackPart One: Building Web Apps with the MERN Stack
Part One: Building Web Apps with the MERN Stack
MongoDB
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - Habilelabs
HabileLabs
 
Mongo db transcript
Mongo db transcriptMongo db transcript
Mongo db transcript
foliba
 
Mongodb
MongodbMongodb
Mongodb
foliba
 
Redis Overview
Redis OverviewRedis Overview
Redis Overview
Hoang Long
 
MongoDB - Getting Started
MongoDB  - Getting StartedMongoDB  - Getting Started
MongoDB - Getting Started
Ahmed Helmy
 

Viewers also liked (20)

MongoDB by Tonny
MongoDB by TonnyMongoDB by Tonny
MongoDB by Tonny
Agate Studio
 
Mongo db roma replication and sharding
Mongo db roma replication and shardingMongo db roma replication and sharding
Mongo db roma replication and sharding
Guglielmo Incisa Di Camerana
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
Tharun Srinivasa
 
MongoDB: Replication,Sharding,MapReduce
MongoDB: Replication,Sharding,MapReduceMongoDB: Replication,Sharding,MapReduce
MongoDB: Replication,Sharding,MapReduce
Takahiro Inoue
 
Column Stores and Google BigQuery
Column Stores and Google BigQueryColumn Stores and Google BigQuery
Column Stores and Google BigQuery
Csaba Toth
 
Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?
Tim Lossen
 
VLDB 2009 Tutorial on Column-Stores
VLDB 2009 Tutorial on Column-StoresVLDB 2009 Tutorial on Column-Stores
VLDB 2009 Tutorial on Column-Stores
Daniel Abadi
 
MongoDB: Advance concepts - Replication and Sharding
MongoDB: Advance concepts - Replication and ShardingMongoDB: Advance concepts - Replication and Sharding
MongoDB: Advance concepts - Replication and Sharding
Knoldus Inc.
 
Big data key-value and column stores redis - cassandra
Big data  key-value and column stores redis - cassandraBig data  key-value and column stores redis - cassandra
Big data key-value and column stores redis - cassandra
JWORKS powered by Ordina
 
"Sharding - patterns & antipatterns". Доклад Алексея Рыбака (Badoo) и Констан...
"Sharding - patterns & antipatterns". Доклад Алексея Рыбака (Badoo) и Констан..."Sharding - patterns & antipatterns". Доклад Алексея Рыбака (Badoo) и Констан...
"Sharding - patterns & antipatterns". Доклад Алексея Рыбака (Badoo) и Констан...
Badoo Development
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDB
Pankaj Bajaj
 
mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012
Chris Westin
 
MongoDB Devops Madrid February 2012
MongoDB Devops Madrid February 2012MongoDB Devops Madrid February 2012
MongoDB Devops Madrid February 2012
Juan Vicente Herrera Ruiz de Alejo
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
christkv
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Knoldus Inc.
 
Seth Edwards on MongoDB
Seth Edwards on MongoDBSeth Edwards on MongoDB
Seth Edwards on MongoDB
Skills Matter
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Sean Laurent
 
MongoDB
MongoDBMongoDB
MongoDB
Tharun Srinivasa
 
Intro to NoSQL and MongoDB
 Intro to NoSQL and MongoDB Intro to NoSQL and MongoDB
Intro to NoSQL and MongoDB
MongoDB
 
Mastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellMastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript Shell
Scott Hernandez
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
Tharun Srinivasa
 
MongoDB: Replication,Sharding,MapReduce
MongoDB: Replication,Sharding,MapReduceMongoDB: Replication,Sharding,MapReduce
MongoDB: Replication,Sharding,MapReduce
Takahiro Inoue
 
Column Stores and Google BigQuery
Column Stores and Google BigQueryColumn Stores and Google BigQuery
Column Stores and Google BigQuery
Csaba Toth
 
Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?
Tim Lossen
 
VLDB 2009 Tutorial on Column-Stores
VLDB 2009 Tutorial on Column-StoresVLDB 2009 Tutorial on Column-Stores
VLDB 2009 Tutorial on Column-Stores
Daniel Abadi
 
MongoDB: Advance concepts - Replication and Sharding
MongoDB: Advance concepts - Replication and ShardingMongoDB: Advance concepts - Replication and Sharding
MongoDB: Advance concepts - Replication and Sharding
Knoldus Inc.
 
Big data key-value and column stores redis - cassandra
Big data  key-value and column stores redis - cassandraBig data  key-value and column stores redis - cassandra
Big data key-value and column stores redis - cassandra
JWORKS powered by Ordina
 
"Sharding - patterns & antipatterns". Доклад Алексея Рыбака (Badoo) и Констан...
"Sharding - patterns & antipatterns". Доклад Алексея Рыбака (Badoo) и Констан..."Sharding - patterns & antipatterns". Доклад Алексея Рыбака (Badoo) и Констан...
"Sharding - patterns & antipatterns". Доклад Алексея Рыбака (Badoo) и Констан...
Badoo Development
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDB
Pankaj Bajaj
 
mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012
Chris Westin
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
christkv
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Knoldus Inc.
 
Seth Edwards on MongoDB
Seth Edwards on MongoDBSeth Edwards on MongoDB
Seth Edwards on MongoDB
Skills Matter
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Sean Laurent
 
Intro to NoSQL and MongoDB
 Intro to NoSQL and MongoDB Intro to NoSQL and MongoDB
Intro to NoSQL and MongoDB
MongoDB
 
Mastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellMastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript Shell
Scott Hernandez
 
Ad

Similar to MongoDB Introduction - Document Oriented Nosql Database (20)

Mongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorialMongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorial
Mohan Rathour
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Cons
johnrjenson
 
Mongodb
MongodbMongodb
Mongodb
ASEEMSRIVASTAVA22
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data science
bitragowthamkumar1
 
MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer GuideMongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer Guide
Shiv K Sah
 
Mongodb
MongodbMongodb
Mongodb
Apurva Vyas
 
9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented Databases
Fabio Fumarola
 
MongoDB
MongoDBMongoDB
MongoDB
Rony Gregory
 
Mongo db
Mongo dbMongo db
Mongo db
AbhiKhurana8
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
Surya937648
 
MongoDB
MongoDBMongoDB
MongoDB
nikhil2807
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
Tata Consultancy Services
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
Sarang Shravagi
 
A Study on Mongodb Database
A Study on Mongodb DatabaseA Study on Mongodb Database
A Study on Mongodb Database
IJSRD
 
A Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfA Study on Mongodb Database.pdf
A Study on Mongodb Database.pdf
Jessica Navarro
 
MongoDB Knowledge share
MongoDB Knowledge shareMongoDB Knowledge share
MongoDB Knowledge share
Mr Kyaing
 
MongoDB for the SQL Server
MongoDB for the SQL ServerMongoDB for the SQL Server
MongoDB for the SQL Server
Paulo Fagundes
 
MongoDB Interview Questions PDF By ScholarHat
MongoDB Interview Questions PDF By ScholarHatMongoDB Interview Questions PDF By ScholarHat
MongoDB Interview Questions PDF By ScholarHat
Scholarhat
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
Sigit52
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Mike Dirolf
 
Mongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorialMongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorial
Mohan Rathour
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Cons
johnrjenson
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data science
bitragowthamkumar1
 
MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer GuideMongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer Guide
Shiv K Sah
 
9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented Databases
Fabio Fumarola
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
Surya937648
 
A Study on Mongodb Database
A Study on Mongodb DatabaseA Study on Mongodb Database
A Study on Mongodb Database
IJSRD
 
A Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfA Study on Mongodb Database.pdf
A Study on Mongodb Database.pdf
Jessica Navarro
 
MongoDB Knowledge share
MongoDB Knowledge shareMongoDB Knowledge share
MongoDB Knowledge share
Mr Kyaing
 
MongoDB for the SQL Server
MongoDB for the SQL ServerMongoDB for the SQL Server
MongoDB for the SQL Server
Paulo Fagundes
 
MongoDB Interview Questions PDF By ScholarHat
MongoDB Interview Questions PDF By ScholarHatMongoDB Interview Questions PDF By ScholarHat
MongoDB Interview Questions PDF By ScholarHat
Scholarhat
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
Sigit52
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Mike Dirolf
 
Ad

Recently uploaded (20)

Rebuilding Cadabra Studio: AI as Our Core Foundation
Rebuilding Cadabra Studio: AI as Our Core FoundationRebuilding Cadabra Studio: AI as Our Core Foundation
Rebuilding Cadabra Studio: AI as Our Core Foundation
Cadabra Studio
 
How to purchase, license and subscribe to Microsoft Azure_PDF.pdf
How to purchase, license and subscribe to Microsoft Azure_PDF.pdfHow to purchase, license and subscribe to Microsoft Azure_PDF.pdf
How to purchase, license and subscribe to Microsoft Azure_PDF.pdf
victordsane
 
Techdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk takerTechdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk taker
RajaNagendraKumar
 
Design by Contract - Building Robust Software with Contract-First Development
Design by Contract - Building Robust Software with Contract-First DevelopmentDesign by Contract - Building Robust Software with Contract-First Development
Design by Contract - Building Robust Software with Contract-First Development
Par-Tec S.p.A.
 
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Micro-Metrics Every Performance Engineer Should Validate Before Sign-OffMicro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Tier1 app
 
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Prachi Desai
 
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
Nacho Cougil
 
Custom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdfCustom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdf
Digital Aptech
 
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
gauravvmanchandaa200
 
AI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATION
AI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATIONAI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATION
AI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATION
miso_uam
 
zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17
zOSCommserver
 
Scalefusion Remote Access for Apple Devices
Scalefusion Remote Access for Apple DevicesScalefusion Remote Access for Apple Devices
Scalefusion Remote Access for Apple Devices
Scalefusion
 
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdfSecure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Northwind Technologies
 
ICDL FULL STANDARD 2025 Luisetto mauro - Academia domani- 55 HOURS LONG pdf
ICDL FULL STANDARD  2025 Luisetto mauro - Academia domani- 55 HOURS LONG pdfICDL FULL STANDARD  2025 Luisetto mauro - Academia domani- 55 HOURS LONG pdf
ICDL FULL STANDARD 2025 Luisetto mauro - Academia domani- 55 HOURS LONG pdf
M. Luisetto Pharm.D.Spec. Pharmacology
 
Facility Management Solution - TeroTAM CMMS Software
Facility Management Solution - TeroTAM CMMS SoftwareFacility Management Solution - TeroTAM CMMS Software
Facility Management Solution - TeroTAM CMMS Software
TeroTAM
 
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjaraswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
muhammadalikhanalikh1
 
The rise of e-commerce has redefined how retailers operate—and reconciliation...
The rise of e-commerce has redefined how retailers operate—and reconciliation...The rise of e-commerce has redefined how retailers operate—and reconciliation...
The rise of e-commerce has redefined how retailers operate—and reconciliation...
Prachi Desai
 
Agentic AI Desgin Principles in five slides.pptx
Agentic AI Desgin Principles in five slides.pptxAgentic AI Desgin Principles in five slides.pptx
Agentic AI Desgin Principles in five slides.pptx
MOSIUOA WESI
 
AI Alternative - Discover the best AI tools and their alternatives
AI Alternative - Discover the best AI tools and their alternativesAI Alternative - Discover the best AI tools and their alternatives
AI Alternative - Discover the best AI tools and their alternatives
AI Alternative
 
Oliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdfOliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdf
GiliardGodoi1
 
Rebuilding Cadabra Studio: AI as Our Core Foundation
Rebuilding Cadabra Studio: AI as Our Core FoundationRebuilding Cadabra Studio: AI as Our Core Foundation
Rebuilding Cadabra Studio: AI as Our Core Foundation
Cadabra Studio
 
How to purchase, license and subscribe to Microsoft Azure_PDF.pdf
How to purchase, license and subscribe to Microsoft Azure_PDF.pdfHow to purchase, license and subscribe to Microsoft Azure_PDF.pdf
How to purchase, license and subscribe to Microsoft Azure_PDF.pdf
victordsane
 
Techdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk takerTechdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk taker
RajaNagendraKumar
 
Design by Contract - Building Robust Software with Contract-First Development
Design by Contract - Building Robust Software with Contract-First DevelopmentDesign by Contract - Building Robust Software with Contract-First Development
Design by Contract - Building Robust Software with Contract-First Development
Par-Tec S.p.A.
 
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Micro-Metrics Every Performance Engineer Should Validate Before Sign-OffMicro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Tier1 app
 
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Prachi Desai
 
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
Nacho Cougil
 
Custom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdfCustom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdf
Digital Aptech
 
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
gauravvmanchandaa200
 
AI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATION
AI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATIONAI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATION
AI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATION
miso_uam
 
zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17
zOSCommserver
 
Scalefusion Remote Access for Apple Devices
Scalefusion Remote Access for Apple DevicesScalefusion Remote Access for Apple Devices
Scalefusion Remote Access for Apple Devices
Scalefusion
 
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdfSecure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Northwind Technologies
 
ICDL FULL STANDARD 2025 Luisetto mauro - Academia domani- 55 HOURS LONG pdf
ICDL FULL STANDARD  2025 Luisetto mauro - Academia domani- 55 HOURS LONG pdfICDL FULL STANDARD  2025 Luisetto mauro - Academia domani- 55 HOURS LONG pdf
ICDL FULL STANDARD 2025 Luisetto mauro - Academia domani- 55 HOURS LONG pdf
M. Luisetto Pharm.D.Spec. Pharmacology
 
Facility Management Solution - TeroTAM CMMS Software
Facility Management Solution - TeroTAM CMMS SoftwareFacility Management Solution - TeroTAM CMMS Software
Facility Management Solution - TeroTAM CMMS Software
TeroTAM
 
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjaraswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
muhammadalikhanalikh1
 
The rise of e-commerce has redefined how retailers operate—and reconciliation...
The rise of e-commerce has redefined how retailers operate—and reconciliation...The rise of e-commerce has redefined how retailers operate—and reconciliation...
The rise of e-commerce has redefined how retailers operate—and reconciliation...
Prachi Desai
 
Agentic AI Desgin Principles in five slides.pptx
Agentic AI Desgin Principles in five slides.pptxAgentic AI Desgin Principles in five slides.pptx
Agentic AI Desgin Principles in five slides.pptx
MOSIUOA WESI
 
AI Alternative - Discover the best AI tools and their alternatives
AI Alternative - Discover the best AI tools and their alternativesAI Alternative - Discover the best AI tools and their alternatives
AI Alternative - Discover the best AI tools and their alternatives
AI Alternative
 
Oliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdfOliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdf
GiliardGodoi1
 

MongoDB Introduction - Document Oriented Nosql Database

  • 1. By : Sudhir Patil @spatilTweet
  • 2. I will talk …. •What is MongoDB ? •Queries in MongoDB •Replication •Sharding •Other Cool Features •Code samples •Performance • When to Use & not Use?
  • 3. What is MongoDB? •Document-oriented •JSON-style documents (Actually BSON) •Dynamic Schema •Non Relational (NOSQL) •Performance •Written in C++ for high •Full Index support •No Transactions (but supports atomic operations) •Not relational •Scalability •Replication •Shardinges
  • 4. Who is using MongoDB? See more @ http://www.mongodb.org/display/DOCS/Production+Deployments
  • 5. Document Oriented?? You can store and access data in real life document style. - Can have any number of fields. - Can contain other documents(comments in below example) - Can store array/collection elements (e.g tags) - Not restricted to strict columns and rows. Document can con For RDBMS people, its denormalized view by combining multiple tables relational databases. { “title”: “NoSQL Database Internals”, “date”: “Tue Oct 27 2009 17:24:18 GMT-0400 (EDT)”, “content” : “ Database internals …….”, “author” : “xxxxxx” , “tags”: [“nosql”, “databases”, “c++”], “comments”: [ {“author”: “Fred”, “text”: “Quite” } ] }
  • 6. How to access/query data? db.post.find() ➔ SELECT * FROM post db.posts.find({“author”:“Kyle”}) db.posts.find(“tags”: “nosql”) db.posts.find({“date”: {“$lte”: Date.now}) db.post.find({“comments.username”: “eh”})
  • 7. Insert/Update/Alter? Insert db.user.insert({‘name’ : ‘foobar’, ‘age’ : 25}) ➔ INSERT INTO user (`name`, `age`) values ('foobar',25) Update db.user.update({'name' : 'foobar'}, {$set : {'age' : 36}}) ➔ UPDATE user SET `age` = 36 WHERE `name` = 'foobar‘ if you want add a column `email` db.user.insert({‘name’ : ‘foobar’, ‘age’ : 25, ‘email’ : ‘[email protected]’}) ➔ ALTER TABLE user…. Delete db.user.remove({'age' : {$lt : 30}}) ➔ DELETE FROM user WHERE age < 30
  • 8. But why should i use instead of RDBS(say mysql)? ● If you got huge data, thats difficult to manage in RDBMS, without lot of firefight. ● Dynamic schema, application can add new fields just by adding fields in Object mapping collection(table). ● Faster development, as you don’t need alter table scripts and don’t need to split your data into columns. ● Easier to scale and shard. ● New shiny thing?
  • 9. DriversDrivers / Libraries •All most all Famous languages have drivers for mongodb. More details @ http://www.mongodb.org/display/DOCS/Drivers •OR M (Object relational mappers) o Java - morphia, spring data o Ruby - mongoid, mongoMapper o Php - doctrine, mongodloid o node.js - Mongoose.
  • 12. Other Cool Features • Grid FS • Store files of any size • GridFS will leverage any existing replication or autosharding that you’ve set up for MongoDB, so getting failover and scale-out for file •Map Reduce •Queries run in all shards parallel •Flexible aggregation and data processing •Geospatial Indexing •Find objects based on location – Find closest n items to x e.g db.map.insert({location : {longitude : -40, latitude : 78}}) db.map.find({location : {$near : [ -30, 70]})
  • 13. Performance Source: http://www.idiotsabound.com/did-i-mention-mongodb-is-fast-way-to-go-mongo |+-------------------------------------------------------------------------+| **** 100000 Indexed Queries **** |+-------------------------------------------------------------------------+| | Average | Median | Deviation | Lap Total | Total | +-------------------------------------------------------------------------+ | MongoDb | 0.00025 | 0.00021 | 0.00019 | 24.99955 | 29.138463 | | CouchDb | 0.01098 | 0.01067 | 0.00972 | 1097.85109 | 1101.09003 | | MysqlDb | 0.00199 | 0.00032 | 0.00518 | 199.32546 | 201.88513 | +---------------------------------------------------------------------------+
  • 15. Code Samples : Music Band Band Contact Info Distributor Song 1 10…. * 0…. *
  • 16. When Not to use it / Drawbacks? • If your data is not huge and comfortably fits in RDBMS • If you need transactional features. • If you have complex Relationships. • Learning curve, querying etc is not hard in mongo but almost everyone knows SQL syntax. • Global write lock. • Duplicate data and data integrity as same piece of data may be embedded in multiple documents. • You have to manage any relationships at application layer.
  • 17. Nuggets • Consider it only when your data is huge or doesn’t really suit relational structure. • Very easy & enjoyable at development phase but as application grows data stored might get messy. So store and retrieve data using ORM objects only and be careful while changing object fields e.g renaming. • Relationships ,constraints, integrity etc have to be managed at application level, unlike RDBMS where all these are built in. • Don’t stuff everything in single document, use references to other documents when appropriate. • Querying is not hard but takes some time to get used to it, so not easy as querying in SQL.