SlideShare ist ein Scribd-Unternehmen logo
1 von 23
MongoDB : NoSQL
- Bhagwat Kumar
Agenda
1. Introduction to NoSQLand
MongoDB
2. Installation
3. Queries
4. Indexing
5. Schema modeling
6. Aggregation
Introduction to NoSQL
• Not onlySQL
• Stores and retrieves data with less constrained consistency
model than RDBMS
• More scalable and have finer control over availability.
• Handle large volumes of structured/unstructured data.
• Efficient scale-out architecture.
• Highly optimized key-valuestores
NoSQL data models
• Document model
• Uses embedded data thus no joins
• MongoDB and couchDB
• Graphmodel
• Used where relationships are core to app.
• Neo4j and HyperGraphDB
• Key-value and wide column model
• Redis, Riak :Key-value
• Cassandra, BigTable :wide column model
• Popular NoSQLdatabases : http://nosql-database.org
MongoDB
• Open source
• Document data model
• Rich querymodel
• Full Index Support
• High performance with highavailability
• Horizontal scalability
• Map/Reduce
• Geospatial support
• Professional Support ByMongoDB
MongoDB Data Model
• Stores dataas documents in BSON representation
• BJON extends JSON to include additional types :
-Int, long, floating point, arrays, binary data,sub-documents
MongoDB data model continued :
Collection
Collection
Collection
Document
Document
Document
Field
Field
Field
Database
NongoDB Data
Structure
Compare RDBMS terms with MongoDB
RDBMS MongoDB
Database Database
Tables Collections
Rows Documents
Columns Key
MongoDB is schema-less. Each document can have different
number of keys(fields) and and store different types of data.
{name :‘Rajeev’, age :45, hobby :[“Cricket”, “Movies”]}
{name :42, age :45, profession : “Software engineer”}
Both the above documents can reside in same collection.
Getting Started: MongoDB
• Installing MongoDB
• sudo apt-get installmongodb
• Default directory formongodb data is /data/db
• StartMongoDB server
• mongod
• mongod--dbpath /var/mongo/backup
• mongod--port 12345 # default is27017
• mongod --fork –logpath /var/log/mongodb.log
• Startmongo shell
• mongo
Getting Started Cont...
• Getting listof existing databases
• show dbs
• Getting listof tables
• show collections
•Usingdatabase
•use dbName
• Insertingdocument
•db.collectionName.insert(document)
• Gettinghelp
• anycommand.help()
• See implementationof a function
• call functionwithout ()
Add documents
• Simple Object
db.products.insert( { item: "card", qty: 15 } )
{
"_id" : ObjectId("5298c9e02646f5705c34cd34"),
"item" : "card", "qty" : 15
}
• Embedded Object
db.user.insert( {name: {first: "Bhagwat”, last:"Kumar"} } )
{
"_id" : ObjectId("5298cbb42646f5705c34cd35"),
"name" : { "first" : "Bhagwat", "last" : "Kumar" }
}
Insert document Cont...
• Document withsimple arrays
db.user.insert( {
name: “John”, ”hobbies":[“Cricket”, “Footbal”,“Reading”]
})
• Document withArraysof sub documents
db.users.insert({
name :‘Graeme Rocher’,
books :[
{name :‘Grails’, pages :300},
{name :‘Groovy’, pages :200}
]
})
Querying collections
• Selecting all documents
db.inventory.find( {})
db.inventory.find( {})
• Findby example
db.inventory.find( {type: "snacks" })
db.inventory.find( {type: 'food', price: {$lt: 9.95 }})
• UseOR Condition
db.inventory.find( {$or:[{type : ‘food’}, {price :{$lte : 9.95}
}])
•Use AND Condition
db.inventory.find( {$and: [{type :‘food’}, {price :{$lte :
9.95}}])
MongoDB Update Query
• Update query
db.collection.update(
<query>,<update>,{upsert:boolean,multi:true})
• query - selection criteria
db.users.update(
{name:”himanshu”},
{$set:{age:32}},
multi:true)
Removing documents
• Remove all documents
db.inventory.remove()
• Remove all documents matching specific condition
db.inventory.remove( {type :"food" })
• Removing single document matching condition
db.inventory.remove( {type :"food" },1)
Aggregation framework
• Aggregation operations processes data records and returns
computed results
• It group values from multiple documents together and can
perform a variety of operations on the grouped data to return
a single result
Aggregation samples
SELECTCOUNT(*)AScount FROM orders
db. orders.aggregate([{$group :{_id:null,total:{$sum:1}}}]);
SELECTSUM(price) AStotal FROMorders
db. orders.aggregate([{$group :{_id:null, total :{$sum:”$price”}}}]);
SELECTcust_id, SUM(price) AStotal FROMorders GROUPBYcust_id
db. orders.aggregate([{$group :{_id:“$cust_id”, total :{$sum:”$price”}}}]);
SELECTcust_id,SUM(price) AStFROMorders GROUPBYcust_id ORDERBYt
db. orders.aggregate([{
$group :{_id:“$cust_id”, t:{$sum: ”$price”}}},
{ $sort :{t:1}}]);
Speed up search and sorting : Index
• Without index MongoDB must scan every document in a collection
• No additional sort phase is executed if there exist corresponding index
• Results will be returned directly if projection includes only the index fields
• Affects the aggregation framework as well
• Supports variety of index types :geolocation, arrays etc.
Types of index
• Default by mongoDB_id
• Single field
db.friends.ensureIndex({“name” :1})
• Compound field
db.events.ensureIndex({“username” :1, date :-1
db.events.find().sort({username:1, date: -1}) #usesindx
db.events.find().sort({username: -1, date: 1})#uses index
db.event.find().sort({username: 1, date:1}) #index not used
Compound indexes support queries on any prefix of the index fields
• Multikey index
• For arrays by default
• Geospatial indexes
• Used by geospatial queries e.g. $near, $centerSphere, $within etc.
Schema design factors
• Rich documents
• Pre-join / Embed data
• No Mongo joins
• No constraints
• Atomic operations
• No declared schema
References
http://www.mongodb.com/learn/nosql
http://docs.mongodb.org/manual/core/introduction/
http://en.wikipedia.org/wiki/NoSQL
http://blog.nahurst.com/visual-guide-to-nosql-systems
http://www.slideshare.net/quipo/nosql-databases-why-what-and-when
http://www.slideshare.net/mongodb/webinar-data-processing-and-
aggregation-options
http://www.slideshare.net/mongodb/building-your-first-app-with-mongo-db-
28536013
Contact us
As the Advanced Consulting
Partners of MongoDB we
have delivered some
amazing MongoDB
development projects,
Know more:
Click Here To Know More!
Have more queries
related to MongoDB?
Talk To Our Experts!
Our Office
Client
Location

Weitere ähnliche Inhalte

Was ist angesagt?

Back to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLBack to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLMongoDB
 
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsMongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsSpringPeople
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMetatagg Solutions
 
ENIB 2015 2016 - CAI Web S02E03 - Forge JS 2/4 - MongoDB and NoSQL
ENIB 2015 2016 - CAI Web S02E03 - Forge JS 2/4 - MongoDB and NoSQLENIB 2015 2016 - CAI Web S02E03 - Forge JS 2/4 - MongoDB and NoSQL
ENIB 2015 2016 - CAI Web S02E03 - Forge JS 2/4 - MongoDB and NoSQLHoracio Gonzalez
 
ENIB 2015-2016 - CAI Web - S01E01- MongoDB and NoSQL
ENIB 2015-2016 - CAI Web - S01E01- MongoDB and NoSQLENIB 2015-2016 - CAI Web - S01E01- MongoDB and NoSQL
ENIB 2015-2016 - CAI Web - S01E01- MongoDB and NoSQLHoracio Gonzalez
 
PhpstudyTokyo MongoDB PHP CakePHP
PhpstudyTokyo MongoDB PHP CakePHPPhpstudyTokyo MongoDB PHP CakePHP
PhpstudyTokyo MongoDB PHP CakePHPichikaway
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo dbRohit Bishnoi
 
Webinar: Building Your First MongoDB App
Webinar: Building Your First MongoDB AppWebinar: Building Your First MongoDB App
Webinar: Building Your First MongoDB AppMongoDB
 
MongoDB : The Definitive Guide
MongoDB : The Definitive GuideMongoDB : The Definitive Guide
MongoDB : The Definitive GuideWildan Maulana
 
2011 Mongo FR - Indexing in MongoDB
2011 Mongo FR - Indexing in MongoDB2011 Mongo FR - Indexing in MongoDB
2011 Mongo FR - Indexing in MongoDBantoinegirbal
 

Was ist angesagt? (20)

Back to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLBack to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQL
 
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsMongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
 
MongoDB at GUL
MongoDB at GULMongoDB at GUL
MongoDB at GUL
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongodb
MongodbMongodb
Mongodb
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg Solutions
 
ENIB 2015 2016 - CAI Web S02E03 - Forge JS 2/4 - MongoDB and NoSQL
ENIB 2015 2016 - CAI Web S02E03 - Forge JS 2/4 - MongoDB and NoSQLENIB 2015 2016 - CAI Web S02E03 - Forge JS 2/4 - MongoDB and NoSQL
ENIB 2015 2016 - CAI Web S02E03 - Forge JS 2/4 - MongoDB and NoSQL
 
ENIB 2015-2016 - CAI Web - S01E01- MongoDB and NoSQL
ENIB 2015-2016 - CAI Web - S01E01- MongoDB and NoSQLENIB 2015-2016 - CAI Web - S01E01- MongoDB and NoSQL
ENIB 2015-2016 - CAI Web - S01E01- MongoDB and NoSQL
 
PhpstudyTokyo MongoDB PHP CakePHP
PhpstudyTokyo MongoDB PHP CakePHPPhpstudyTokyo MongoDB PHP CakePHP
PhpstudyTokyo MongoDB PHP CakePHP
 
Mongo DB 102
Mongo DB 102Mongo DB 102
Mongo DB 102
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
MongoDB
MongoDBMongoDB
MongoDB
 
Webinar: Building Your First MongoDB App
Webinar: Building Your First MongoDB AppWebinar: Building Your First MongoDB App
Webinar: Building Your First MongoDB App
 
Mongo db nosql (1)
Mongo db nosql (1)Mongo db nosql (1)
Mongo db nosql (1)
 
MongoDB : The Definitive Guide
MongoDB : The Definitive GuideMongoDB : The Definitive Guide
MongoDB : The Definitive Guide
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
MongoDB 101
MongoDB 101MongoDB 101
MongoDB 101
 
2011 Mongo FR - Indexing in MongoDB
2011 Mongo FR - Indexing in MongoDB2011 Mongo FR - Indexing in MongoDB
2011 Mongo FR - Indexing in MongoDB
 
Python and MongoDB
Python and MongoDB Python and MongoDB
Python and MongoDB
 

Andere mochten auch

Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDBPankaj Bajaj
 
An Evening with MongoDB - Orlando: Welcome and Keynote
An Evening with MongoDB - Orlando: Welcome and KeynoteAn Evening with MongoDB - Orlando: Welcome and Keynote
An Evening with MongoDB - Orlando: Welcome and KeynoteMongoDB
 
Intro to NoSQL and MongoDB
 Intro to NoSQL and MongoDB Intro to NoSQL and MongoDB
Intro to NoSQL and MongoDBMongoDB
 
Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)MongoSF
 
Mastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellMastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellScott Hernandez
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBKnoldus Inc.
 
mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012Chris Westin
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBSean Laurent
 
Mongodb intro
Mongodb introMongodb intro
Mongodb introchristkv
 
Seth Edwards on MongoDB
Seth Edwards on MongoDBSeth Edwards on MongoDB
Seth Edwards on MongoDBSkills Matter
 
Zero to Mongo in 60 Hours
Zero to Mongo in 60 HoursZero to Mongo in 60 Hours
Zero to Mongo in 60 HoursMongoSF
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewNorberto Leite
 

Andere mochten auch (20)

Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDB
 
An Evening with MongoDB - Orlando: Welcome and Keynote
An Evening with MongoDB - Orlando: Welcome and KeynoteAn Evening with MongoDB - Orlando: Welcome and Keynote
An Evening with MongoDB - Orlando: Welcome and Keynote
 
MongoDB Devops Madrid February 2012
MongoDB Devops Madrid February 2012MongoDB Devops Madrid February 2012
MongoDB Devops Madrid February 2012
 
Intro to NoSQL and MongoDB
 Intro to NoSQL and MongoDB Intro to NoSQL and MongoDB
Intro to NoSQL and MongoDB
 
Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)
 
Mastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellMastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript Shell
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
MongoDB
MongoDBMongoDB
MongoDB
 
Seth Edwards on MongoDB
Seth Edwards on MongoDBSeth Edwards on MongoDB
Seth Edwards on MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB 3.0
MongoDB 3.0 MongoDB 3.0
MongoDB 3.0
 
Plan de entrenamiento Maratón de Madrid Mes 3
Plan de entrenamiento Maratón de Madrid Mes 3Plan de entrenamiento Maratón de Madrid Mes 3
Plan de entrenamiento Maratón de Madrid Mes 3
 
Mongo db intro new
Mongo db intro newMongo db intro new
Mongo db intro new
 
Zero to Mongo in 60 Hours
Zero to Mongo in 60 HoursZero to Mongo in 60 Hours
Zero to Mongo in 60 Hours
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature Preview
 
Mongodb
MongodbMongodb
Mongodb
 
Mongodb
MongodbMongodb
Mongodb
 

Ähnlich wie MongoDb and NoSQL

MongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlMongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlTO THE NEW | Technology
 
Indexing Strategies to Help You Scale
Indexing Strategies to Help You ScaleIndexing Strategies to Help You Scale
Indexing Strategies to Help You ScaleMongoDB
 
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptxsukrithlal008
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsMongoDB
 
2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongo2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongoMichael Bright
 
Using MongoDB and Python
Using MongoDB and PythonUsing MongoDB and Python
Using MongoDB and PythonMike Bright
 
How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's A...
How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's A...How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's A...
How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's A...Gianfranco Palumbo
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDBElieHannouch
 
MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewAntonio Pintus
 
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesBack to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesMongoDB
 
Fast querying indexing for performance (4)
Fast querying   indexing for performance (4)Fast querying   indexing for performance (4)
Fast querying indexing for performance (4)MongoDB
 
Getting Started with Geospatial Data in MongoDB
Getting Started with Geospatial Data in MongoDBGetting Started with Geospatial Data in MongoDB
Getting Started with Geospatial Data in MongoDBMongoDB
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)Uwe Printz
 
1403 app dev series - session 5 - analytics
1403   app dev series - session 5 - analytics1403   app dev series - session 5 - analytics
1403 app dev series - session 5 - analyticsMongoDB
 
London MongoDB User Group April 2011
London MongoDB User Group April 2011London MongoDB User Group April 2011
London MongoDB User Group April 2011Rainforest QA
 

Ähnlich wie MongoDb and NoSQL (20)

MongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlMongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behl
 
MongoDB_ppt.pptx
MongoDB_ppt.pptxMongoDB_ppt.pptx
MongoDB_ppt.pptx
 
Indexing Strategies to Help You Scale
Indexing Strategies to Help You ScaleIndexing Strategies to Help You Scale
Indexing Strategies to Help You Scale
 
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
 
2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongo2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongo
 
Using MongoDB and Python
Using MongoDB and PythonUsing MongoDB and Python
Using MongoDB and Python
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's A...
How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's A...How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's A...
How to leverage MongoDB for Big Data Analysis and Operations with MongoDB's A...
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDB
 
Full metal mongo
Full metal mongoFull metal mongo
Full metal mongo
 
MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overview
 
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesBack to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
 
Fast querying indexing for performance (4)
Fast querying   indexing for performance (4)Fast querying   indexing for performance (4)
Fast querying indexing for performance (4)
 
Getting Started with Geospatial Data in MongoDB
Getting Started with Geospatial Data in MongoDBGetting Started with Geospatial Data in MongoDB
Getting Started with Geospatial Data in MongoDB
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
 
1403 app dev series - session 5 - analytics
1403   app dev series - session 5 - analytics1403   app dev series - session 5 - analytics
1403 app dev series - session 5 - analytics
 
London MongoDB User Group April 2011
London MongoDB User Group April 2011London MongoDB User Group April 2011
London MongoDB User Group April 2011
 

Mehr von TO THE NEW | Technology

10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!TO THE NEW | Technology
 
10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:TO THE NEW | Technology
 
12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective CTO THE NEW | Technology
 
An introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScriptAn introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScriptTO THE NEW | Technology
 
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape SoftwareTO THE NEW | Technology
 
BigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearchBigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearchTO THE NEW | Technology
 

Mehr von TO THE NEW | Technology (20)

10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!
 
10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:
 
12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C
 
Gulp - The Streaming Build System
Gulp - The Streaming Build SystemGulp - The Streaming Build System
Gulp - The Streaming Build System
 
Grails Spring Boot
Grails Spring BootGrails Spring Boot
Grails Spring Boot
 
AWS Elastic Beanstalk
AWS Elastic BeanstalkAWS Elastic Beanstalk
AWS Elastic Beanstalk
 
Content migration to AEM
Content migration to AEMContent migration to AEM
Content migration to AEM
 
AWS CodeDeploy
AWS CodeDeployAWS CodeDeploy
AWS CodeDeploy
 
Big Data Expertise
Big Data ExpertiseBig Data Expertise
Big Data Expertise
 
An introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScriptAn introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScript
 
Object Oriented JavaScript - II
Object Oriented JavaScript - IIObject Oriented JavaScript - II
Object Oriented JavaScript - II
 
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
 
Cloud Formation
Cloud FormationCloud Formation
Cloud Formation
 
BigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearchBigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearch
 
JULY IN GRAILS
JULY IN GRAILSJULY IN GRAILS
JULY IN GRAILS
 
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
 
Getting groovier-with-vertx
Getting groovier-with-vertxGetting groovier-with-vertx
Getting groovier-with-vertx
 
Introduction to Kanban
Introduction to KanbanIntroduction to Kanban
Introduction to Kanban
 
Introduction to Heroku
Introduction to HerokuIntroduction to Heroku
Introduction to Heroku
 
Node JS
Node JSNode JS
Node JS
 

Kürzlich hochgeladen

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 

Kürzlich hochgeladen (20)

Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 

MongoDb and NoSQL

  • 1.
  • 2. MongoDB : NoSQL - Bhagwat Kumar
  • 3. Agenda 1. Introduction to NoSQLand MongoDB 2. Installation 3. Queries 4. Indexing 5. Schema modeling 6. Aggregation
  • 4. Introduction to NoSQL • Not onlySQL • Stores and retrieves data with less constrained consistency model than RDBMS • More scalable and have finer control over availability. • Handle large volumes of structured/unstructured data. • Efficient scale-out architecture. • Highly optimized key-valuestores
  • 5. NoSQL data models • Document model • Uses embedded data thus no joins • MongoDB and couchDB • Graphmodel • Used where relationships are core to app. • Neo4j and HyperGraphDB • Key-value and wide column model • Redis, Riak :Key-value • Cassandra, BigTable :wide column model • Popular NoSQLdatabases : http://nosql-database.org
  • 6. MongoDB • Open source • Document data model • Rich querymodel • Full Index Support • High performance with highavailability • Horizontal scalability • Map/Reduce • Geospatial support • Professional Support ByMongoDB
  • 7. MongoDB Data Model • Stores dataas documents in BSON representation • BJON extends JSON to include additional types : -Int, long, floating point, arrays, binary data,sub-documents
  • 8. MongoDB data model continued : Collection Collection Collection Document Document Document Field Field Field Database NongoDB Data Structure
  • 9. Compare RDBMS terms with MongoDB RDBMS MongoDB Database Database Tables Collections Rows Documents Columns Key MongoDB is schema-less. Each document can have different number of keys(fields) and and store different types of data. {name :‘Rajeev’, age :45, hobby :[“Cricket”, “Movies”]} {name :42, age :45, profession : “Software engineer”} Both the above documents can reside in same collection.
  • 10. Getting Started: MongoDB • Installing MongoDB • sudo apt-get installmongodb • Default directory formongodb data is /data/db • StartMongoDB server • mongod • mongod--dbpath /var/mongo/backup • mongod--port 12345 # default is27017 • mongod --fork –logpath /var/log/mongodb.log • Startmongo shell • mongo
  • 11. Getting Started Cont... • Getting listof existing databases • show dbs • Getting listof tables • show collections •Usingdatabase •use dbName • Insertingdocument •db.collectionName.insert(document) • Gettinghelp • anycommand.help() • See implementationof a function • call functionwithout ()
  • 12. Add documents • Simple Object db.products.insert( { item: "card", qty: 15 } ) { "_id" : ObjectId("5298c9e02646f5705c34cd34"), "item" : "card", "qty" : 15 } • Embedded Object db.user.insert( {name: {first: "Bhagwat”, last:"Kumar"} } ) { "_id" : ObjectId("5298cbb42646f5705c34cd35"), "name" : { "first" : "Bhagwat", "last" : "Kumar" } }
  • 13. Insert document Cont... • Document withsimple arrays db.user.insert( { name: “John”, ”hobbies":[“Cricket”, “Footbal”,“Reading”] }) • Document withArraysof sub documents db.users.insert({ name :‘Graeme Rocher’, books :[ {name :‘Grails’, pages :300}, {name :‘Groovy’, pages :200} ] })
  • 14. Querying collections • Selecting all documents db.inventory.find( {}) db.inventory.find( {}) • Findby example db.inventory.find( {type: "snacks" }) db.inventory.find( {type: 'food', price: {$lt: 9.95 }}) • UseOR Condition db.inventory.find( {$or:[{type : ‘food’}, {price :{$lte : 9.95} }]) •Use AND Condition db.inventory.find( {$and: [{type :‘food’}, {price :{$lte : 9.95}}])
  • 15. MongoDB Update Query • Update query db.collection.update( <query>,<update>,{upsert:boolean,multi:true}) • query - selection criteria db.users.update( {name:”himanshu”}, {$set:{age:32}}, multi:true)
  • 16. Removing documents • Remove all documents db.inventory.remove() • Remove all documents matching specific condition db.inventory.remove( {type :"food" }) • Removing single document matching condition db.inventory.remove( {type :"food" },1)
  • 17. Aggregation framework • Aggregation operations processes data records and returns computed results • It group values from multiple documents together and can perform a variety of operations on the grouped data to return a single result
  • 18. Aggregation samples SELECTCOUNT(*)AScount FROM orders db. orders.aggregate([{$group :{_id:null,total:{$sum:1}}}]); SELECTSUM(price) AStotal FROMorders db. orders.aggregate([{$group :{_id:null, total :{$sum:”$price”}}}]); SELECTcust_id, SUM(price) AStotal FROMorders GROUPBYcust_id db. orders.aggregate([{$group :{_id:“$cust_id”, total :{$sum:”$price”}}}]); SELECTcust_id,SUM(price) AStFROMorders GROUPBYcust_id ORDERBYt db. orders.aggregate([{ $group :{_id:“$cust_id”, t:{$sum: ”$price”}}}, { $sort :{t:1}}]);
  • 19. Speed up search and sorting : Index • Without index MongoDB must scan every document in a collection • No additional sort phase is executed if there exist corresponding index • Results will be returned directly if projection includes only the index fields • Affects the aggregation framework as well • Supports variety of index types :geolocation, arrays etc.
  • 20. Types of index • Default by mongoDB_id • Single field db.friends.ensureIndex({“name” :1}) • Compound field db.events.ensureIndex({“username” :1, date :-1 db.events.find().sort({username:1, date: -1}) #usesindx db.events.find().sort({username: -1, date: 1})#uses index db.event.find().sort({username: 1, date:1}) #index not used Compound indexes support queries on any prefix of the index fields • Multikey index • For arrays by default • Geospatial indexes • Used by geospatial queries e.g. $near, $centerSphere, $within etc.
  • 21. Schema design factors • Rich documents • Pre-join / Embed data • No Mongo joins • No constraints • Atomic operations • No declared schema
  • 23. Contact us As the Advanced Consulting Partners of MongoDB we have delivered some amazing MongoDB development projects, Know more: Click Here To Know More! Have more queries related to MongoDB? Talk To Our Experts! Our Office Client Location