SlideShare a Scribd company logo
1 of 21
MongoDB In Action 超群.com @fuchaoqun http://www.fuchaoqun.com
I will talk …. ,[object Object]
Dynamic querys
Replication
Sharding
GridFS
Performance,[object Object]
About MongoDB? ,[object Object]
JSON-style documents
Schema-free
Written in C++ for high  performance
Scalable
MapReduce
Many supported platforms & languages,[object Object]
Dynamic querysInsert MySQL: INSERT INOT user (`name`, `age`) values ('foobar',25) Mongo:     db.user.insert({'name' : 'foobar', 'age' : 25}) if you want add a  column `email` on MySQL,you must : ALTER TABLE user…. But in Mongo,you can just:     db.user.insert({'name' : 'foobar', 'age' : 25, 'email' : 'foo@bar.com'})
Dynamic querysDelete MySQL: DELETE * FROM user Mongo:     db.user.remove({}) MySQL: DELETE FROM user WHERE age < 30 Mongo:     db.user.remove({'age' : {$lt : 30}}) $gt : > ; $gte : >= ; $lt : < ; $lte : <= ; $ne : !=
Dynamic querysUpdate MySQL: UPDATE user SET `age` = 36 WHERE `name` = 'foobar' Mongo:     db.user.update({'name' : 'foobar'}, {$set : {'age' : 36}}) MySQL:     UPDATE user SET `age` = `age` + 3 WHERE `name` = 'foobar' Mongo:     db.user.update({'name' : 'foobar'}, {$inc : {'age' : 3}}) See more @ http://tinyurl.com/yka6ras
Dynamic querysAdvanced MySQL: SELECT COUNT(*) FROM user WHERE `name` = 'foobar' Mongo:     db.user.find({'name' : 'foobar'}).count() MySQL:     SELECT * FROM user limit 10,20 Mongo:     db.user.find().skip(10).limit(20)
Dynamic querysAdvanced MySQL: SELECT * FROM user WHERE `age` IN (25, 35,45) Mongo:     db.user.find({'age' : {$in : [25, 35, 45]}}) MySQL:     SELECT * FROM user limit 10,20 Mongo:     db.user.find().skip(10).limit(20)
Dynamic querysAdvanced MySQL: SELECT * FROM user ORDER BY age DESC Mongo:     db.user.find().sort({'age' : -1}) MySQL:     SELECT DISTINCT(name) FROM user WHERE age > 20 Mongo:     db.user.distinct('name', {'age': {$lt : 20}})
Dynamic querysAdvanced MySQL: SELECT name, sum(marks) FROM user GROUP BY name Mongo:     db.user.group({         key : {'name' : true}, cond: {'name' : 'foo'},         reduce: function(obj,prev) { prev.msum += obj.marks; },         initial: {msum : 0}     }); MySQL:     SELECT name FROM user WHERE age < 20 Mongo:     db.user.find('this.age < 20', {name : 1}) See more @ http://tinyurl.com/ykyuuwo

More Related Content

What's hot

言語の設計判断
言語の設計判断言語の設計判断
言語の設計判断
nishio
 
งานย่อยที่ 6
งานย่อยที่ 6งานย่อยที่ 6
งานย่อยที่ 6
Little Thuntun
 
Making Mongo realtime - oplog tailing in Meteor
Making Mongo realtime - oplog tailing in MeteorMaking Mongo realtime - oplog tailing in Meteor
Making Mongo realtime - oplog tailing in Meteor
yaliceme
 

What's hot (15)

Fcontratos
FcontratosFcontratos
Fcontratos
 
Shankar's mongo db presentation
Shankar's mongo db presentationShankar's mongo db presentation
Shankar's mongo db presentation
 
JavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher ChedeauJavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher Chedeau
 
言語の設計判断
言語の設計判断言語の設計判断
言語の設計判断
 
2011 09-pdfjs
2011 09-pdfjs2011 09-pdfjs
2011 09-pdfjs
 
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Apache CouchDB Presentation @ Sept. 2104 GTALUG MeetingApache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
 
NoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDBNoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDB
 
The Lesser Known Features of ECMAScript 6
The Lesser Known Features of ECMAScript 6The Lesser Known Features of ECMAScript 6
The Lesser Known Features of ECMAScript 6
 
DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220
 
MySQL vs. PostgreSQL
MySQL vs. PostgreSQLMySQL vs. PostgreSQL
MySQL vs. PostgreSQL
 
Introduction to MongoDB for C# developers
Introduction to MongoDB for C# developersIntroduction to MongoDB for C# developers
Introduction to MongoDB for C# developers
 
งานย่อยที่ 6
งานย่อยที่ 6งานย่อยที่ 6
งานย่อยที่ 6
 
Making Mongo realtime - oplog tailing in Meteor
Making Mongo realtime - oplog tailing in MeteorMaking Mongo realtime - oplog tailing in Meteor
Making Mongo realtime - oplog tailing in Meteor
 
File-I/O -- ist doch ganz einfach, oder?
File-I/O -- ist doch ganz einfach, oder?File-I/O -- ist doch ganz einfach, oder?
File-I/O -- ist doch ganz einfach, oder?
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 

Similar to MongoDb In Action

Mongodbinaction 100122230824-phpapp01
Mongodbinaction 100122230824-phpapp01Mongodbinaction 100122230824-phpapp01
Mongodbinaction 100122230824-phpapp01
Cevin Cheung
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
saikiran
 
A practical intro to web development with mongo db and nodejs when, why and ...
A practical intro to web development with mongo db and nodejs  when, why and ...A practical intro to web development with mongo db and nodejs  when, why and ...
A practical intro to web development with mongo db and nodejs when, why and ...
jgarifuna
 
A practical intro to web development with mongo db and nodejs when, why and how
A practical intro to web development with mongo db and nodejs  when, why and howA practical intro to web development with mongo db and nodejs  when, why and how
A practical intro to web development with mongo db and nodejs when, why and how
jgarifuna
 
mongoDB Performance
mongoDB PerformancemongoDB Performance
mongoDB Performance
Moshe Kaplan
 

Similar to MongoDb In Action (20)

Mongodbinaction 100122230824-phpapp01
Mongodbinaction 100122230824-phpapp01Mongodbinaction 100122230824-phpapp01
Mongodbinaction 100122230824-phpapp01
 
A Brief MongoDB Intro
A Brief MongoDB IntroA Brief MongoDB Intro
A Brief MongoDB Intro
 
This upload requires better support for ODP format
This upload requires better support for ODP formatThis upload requires better support for ODP format
This upload requires better support for ODP format
 
Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)
 
Python and MongoDB
Python and MongoDB Python and MongoDB
Python and MongoDB
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
 
Back to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDBBack to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDB
 
MongoDB and Python
MongoDB and PythonMongoDB and Python
MongoDB and Python
 
A practical intro to web development with mongo db and nodejs when, why and ...
A practical intro to web development with mongo db and nodejs  when, why and ...A practical intro to web development with mongo db and nodejs  when, why and ...
A practical intro to web development with mongo db and nodejs when, why and ...
 
A practical intro to web development with mongo db and nodejs when, why and how
A practical intro to web development with mongo db and nodejs  when, why and howA practical intro to web development with mongo db and nodejs  when, why and how
A practical intro to web development with mongo db and nodejs when, why and how
 
MongoDB user group israel May
MongoDB user group israel MayMongoDB user group israel May
MongoDB user group israel May
 
Sekilas PHP + mongoDB
Sekilas PHP + mongoDBSekilas PHP + mongoDB
Sekilas PHP + mongoDB
 
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
mongoDB Performance
mongoDB PerformancemongoDB Performance
mongoDB Performance
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 

Recently uploaded

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
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...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

MongoDb In Action

  • 1. MongoDB In Action 超群.com @fuchaoqun http://www.fuchaoqun.com
  • 2.
  • 7.
  • 8.
  • 11. Written in C++ for high performance
  • 14.
  • 15. Dynamic querysInsert MySQL: INSERT INOT user (`name`, `age`) values ('foobar',25) Mongo: db.user.insert({'name' : 'foobar', 'age' : 25}) if you want add a column `email` on MySQL,you must : ALTER TABLE user…. But in Mongo,you can just: db.user.insert({'name' : 'foobar', 'age' : 25, 'email' : 'foo@bar.com'})
  • 16. Dynamic querysDelete MySQL: DELETE * FROM user Mongo: db.user.remove({}) MySQL: DELETE FROM user WHERE age < 30 Mongo: db.user.remove({'age' : {$lt : 30}}) $gt : > ; $gte : >= ; $lt : < ; $lte : <= ; $ne : !=
  • 17. Dynamic querysUpdate MySQL: UPDATE user SET `age` = 36 WHERE `name` = 'foobar' Mongo: db.user.update({'name' : 'foobar'}, {$set : {'age' : 36}}) MySQL: UPDATE user SET `age` = `age` + 3 WHERE `name` = 'foobar' Mongo: db.user.update({'name' : 'foobar'}, {$inc : {'age' : 3}}) See more @ http://tinyurl.com/yka6ras
  • 18. Dynamic querysAdvanced MySQL: SELECT COUNT(*) FROM user WHERE `name` = 'foobar' Mongo: db.user.find({'name' : 'foobar'}).count() MySQL: SELECT * FROM user limit 10,20 Mongo: db.user.find().skip(10).limit(20)
  • 19. Dynamic querysAdvanced MySQL: SELECT * FROM user WHERE `age` IN (25, 35,45) Mongo: db.user.find({'age' : {$in : [25, 35, 45]}}) MySQL: SELECT * FROM user limit 10,20 Mongo: db.user.find().skip(10).limit(20)
  • 20. Dynamic querysAdvanced MySQL: SELECT * FROM user ORDER BY age DESC Mongo: db.user.find().sort({'age' : -1}) MySQL: SELECT DISTINCT(name) FROM user WHERE age > 20 Mongo: db.user.distinct('name', {'age': {$lt : 20}})
  • 21. Dynamic querysAdvanced MySQL: SELECT name, sum(marks) FROM user GROUP BY name Mongo: db.user.group({ key : {'name' : true}, cond: {'name' : 'foo'}, reduce: function(obj,prev) { prev.msum += obj.marks; }, initial: {msum : 0} }); MySQL: SELECT name FROM user WHERE age < 20 Mongo: db.user.find('this.age < 20', {name : 1}) See more @ http://tinyurl.com/ykyuuwo
  • 22. So…. MongoDB can do almost everything that MySQL can do, and quicker & smarter
  • 23.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. Who is using MongoDB? See more @ http://tinyurl.com/dhrryw