SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
MongoDB
Rawin Viruchpintu
Creative Technology Leader
Spriiing Telecom Co.,Ltd.
July 20, 2012
Outline
• MongoDB
• Installation & start
• Using Mongo
• Document-oriented
• Dynamic queries
• Full dynamic index support
• Efficient binary large-object storage
• Built for speed
• Replication and Auto-failover
Installation & start
• Download
http://www.mongodb.org/downloads
• Unzip into a folder
for example /some/path/mongodb
• Run
$bin/mongod --dbpath=/some/path/mongodb
Installation via Rails
• $ gem install mongo
Successfully installed mongo-1.6.4
1 gem installed
Installing ri documentation for mongo-1.6.4...
Installing RDoc documentation for mongo-1.6.4...
Database structure
• Separate DBs
• Organized into Collections
Top-level key -> Document
• Collections
– Group things into logical classes
– Indexable by one or more keys
– Schema-free!
Database structure
• Document
– Always contains key_id
– Creating Relationships:
subdocument, shared key, or DBRef
– Native storage and transfer: BSON
• BSON
– is a binary encoded serialization of JSON-like
documents.
http://bsonspec.org/
Using Mongo
D:mongodbbin>mongo
MongoDB shell version: 2.0.6
connecting to: test
> show dbs
local (empty)
test (empty)
> use test
switched to db test
> db.test.find()
> db.test.save({ name:'windy' , skills: 'blackberry, perl, php' })
> db.test.find()
{ "_id" : ObjectId("5008eb49839a10d95a068a01"), "name" : "windy", "skills" : "bl
ackberry, perl, php" }
Using Mongo
>use things
switched to db things
>for ( var i=1; i<10; i++) db.things.save( {x: 'No.'+i, counter: i } )
>db.things.find()
{ "_id" : ObjectId("5008f81d839a10d95a068a02"), "x" : "No.1", "counter" : 1 }
{ "_id" : ObjectId("5008f81d839a10d95a068a03"), "x" : "No.2", "counter" : 2 }
{ "_id" : ObjectId("5008f81d839a10d95a068a04"), "x" : "No.3", "counter" : 3 }
{ "_id" : ObjectId("5008f81d839a10d95a068a05"), "x" : "No.4", "counter" : 4 }
{ "_id" : ObjectId("5008f81d839a10d95a068a06"), "x" : "No.5", "counter" : 5 }
{ "_id" : ObjectId("5008f81d839a10d95a068a07"), "x" : "No.6", "counter" : 6 }
{ "_id" : ObjectId("5008f81d839a10d95a068a08"), "x" : "No.7", "counter" : 7 }
{ "_id" : ObjectId("5008f81d839a10d95a068a09"), "x" : "No.8", "counter" : 8 }
{ "_id" : ObjectId("5008f81d839a10d95a068a0a"), "x" : "No.9", "counter" : 9 }
Using Mongo
> db.things.find({x: 'No.4'})
{ "_id" : ObjectId("5008f81d839a10d95a068a05"), "x" : "No.4", "counter" : 4 }
> db.things.find({x: 'No.33'})
>
> db.things.find( { counter : { $gt : 5, $lte : 8} })
{ "_id" : ObjectId("5008f81d839a10d95a068a07"), "x" : "No.6", "counter" : 6 }
{ "_id" : ObjectId("5008f81d839a10d95a068a08"), "x" : "No.7", "counter" : 7 }
{ "_id" : ObjectId("5008f81d839a10d95a068a09"), "x" : "No.8", "counter" : 8 }
Using Mongo
> show dbs
local (empty)
things 0.078125GB
> use foo
switched to db foo
> db.foo.save( { name: 'windy', age: 18 } )
> db.foo.find()
{ "_id" : ObjectId("5008fa33839a10d95a068a0b"), "name" : "windy", "age" : 18 }
> db.foo.update( {name: 'windy' }, { $set : { age : 21 } } )
> db.foo.find()
{ "_id" : ObjectId("5008fa33839a10d95a068a0b"), "name" : "windy", "age" : 21 }
Using Mongo
> db.foo.findOne( { name: 'windy'} )
{
"_id" : ObjectId("5008fa33839a10d95a068a0b"),
"name" : "windy",
"age" : 21
}
Using Mongo
> use teams
switched to db teams
> db.teams.save({ team: 'A' , member : [ 'Kai'] })
> db.teams.find()
{
"_id" : ObjectId("5008fc13839a10d95a068a0c"),
"team" : "A",
"member" : [ "Kai” ]
}
> db.teams.update({ team: 'A' },{ $push : { member : 'Windy' } })
> db.teams.findOne()
{
"_id" : ObjectId("5008fc13839a10d95a068a0c"),
"member" : [ "Kai",
"Windy" ],
“team" : "A"
}
Using Mongo
> use simple
switched to db simple
> db.members.save( { name:"Windy", skill: ["java", "php"] } )
> db.teams.save({ team: 'A' })
Members Teams
Windy Project A
project_a =
Using Mongo
> windy = db.members.findOne( {name: "Windy"} )
{
"_id" : ObjectId("50090510839a10d95a068a0f"),
"name" : "Windy",
"skill" : [
"java",
"php"
]
}
> project_a = db.teams.findOne( { team : "A" } )
{ "_id" : ObjectId("50090533839a10d95a068a10"), "team" : "A" }
Project A
Windywindy =
Using Mongo
> project_a.members = []
[ ]
> project_a.members.push (new DBRef ('members', windy._id) )
1
> db.teams.save(project_a)
> project_a
{
"_id" : ObjectId("50090533839a10d95a068a10"),
"team" : "A",
"members" : [
{
"$ref" : "members",
"$id" : ObjectId("50090510839a10d95a068a0f")
}
]
}
Project A
windy = DBRef( )
Teams
Using Mongo
> project_a.members
[ { "$ref" : "members", "$id" : ObjectId("50090510839a10d95a068a0f") } ]
> project_a.members[0]
{ "$ref" : "members", "$id" : ObjectId("50090510839a10d95a068a0f") }
> project_a.members[0].fetch()
{
"_id" : ObjectId("50090510839a10d95a068a0f"),
"name" : "Windy",
"skill" : [
"java",
"php"
]
}
THANK YOU

Contenu connexe

Tendances

Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationMongoDB
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDbsliimohara
 
Basic crud operation
Basic crud operationBasic crud operation
Basic crud operationzarigatongy
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB
 
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...MongoDB
 
MongoDB - Back to Basics - La tua prima Applicazione
MongoDB - Back to Basics - La tua prima ApplicazioneMongoDB - Back to Basics - La tua prima Applicazione
MongoDB - Back to Basics - La tua prima ApplicazioneMassimo Brignoli
 
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMongoDB
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB
 
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte RangeScaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte RangeMongoDB
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用LearningTech
 
Mongodb index 讀書心得
Mongodb index 讀書心得Mongodb index 讀書心得
Mongodb index 讀書心得cc liu
 
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and JavaBuilding a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Javaantoinegirbal
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring DataEric Bottard
 
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...MongoDB
 
Python Development (MongoSF)
Python Development (MongoSF)Python Development (MongoSF)
Python Development (MongoSF)Mike Dirolf
 
Java development with MongoDB
Java development with MongoDBJava development with MongoDB
Java development with MongoDBJames Williams
 
Working with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSONWorking with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSONSV.CO
 
Back to Basics Webinar 3: Schema Design Thinking in Documents
 Back to Basics Webinar 3: Schema Design Thinking in Documents Back to Basics Webinar 3: Schema Design Thinking in Documents
Back to Basics Webinar 3: Schema Design Thinking in DocumentsMongoDB
 

Tendances (20)

Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB Application
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDb
 
Basic crud operation
Basic crud operationBasic crud operation
Basic crud operation
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
 
MongoDB at GUL
MongoDB at GULMongoDB at GUL
MongoDB at GUL
 
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
 
MongoDB - Back to Basics - La tua prima Applicazione
MongoDB - Back to Basics - La tua prima ApplicazioneMongoDB - Back to Basics - La tua prima Applicazione
MongoDB - Back to Basics - La tua prima Applicazione
 
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB Performance
 
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte RangeScaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
 
Mongodb index 讀書心得
Mongodb index 讀書心得Mongodb index 讀書心得
Mongodb index 讀書心得
 
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and JavaBuilding a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Java
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring Data
 
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...
 
Python Development (MongoSF)
Python Development (MongoSF)Python Development (MongoSF)
Python Development (MongoSF)
 
Java development with MongoDB
Java development with MongoDBJava development with MongoDB
Java development with MongoDB
 
Working with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSONWorking with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSON
 
Back to Basics Webinar 3: Schema Design Thinking in Documents
 Back to Basics Webinar 3: Schema Design Thinking in Documents Back to Basics Webinar 3: Schema Design Thinking in Documents
Back to Basics Webinar 3: Schema Design Thinking in Documents
 

En vedette

Windygallery's infographics 2011
Windygallery's infographics 2011Windygallery's infographics 2011
Windygallery's infographics 2011Rawin Windygallery
 
ESP- Summary of Services
ESP- Summary of ServicesESP- Summary of Services
ESP- Summary of Servicesiigsolutions
 
Learning Sessions #6 Residency Incubator Dance Source Houston
Learning Sessions #6 Residency Incubator   Dance Source HoustonLearning Sessions #6 Residency Incubator   Dance Source Houston
Learning Sessions #6 Residency Incubator Dance Source Houstonjvielman
 
Periodical Exam Group 3
Periodical Exam Group 3Periodical Exam Group 3
Periodical Exam Group 3menchie set
 
ZinZin - Para Pengunjung Misterius
ZinZin - Para Pengunjung MisteriusZinZin - Para Pengunjung Misterius
ZinZin - Para Pengunjung MisteriusNur Agustinus
 
Kitab Pertama tentang Masa Kecil Yesus Kristus
Kitab Pertama tentang Masa Kecil Yesus KristusKitab Pertama tentang Masa Kecil Yesus Kristus
Kitab Pertama tentang Masa Kecil Yesus KristusNur Agustinus
 
UC Onliner #5 - Mei-Juni 2014
UC Onliner #5 - Mei-Juni 2014UC Onliner #5 - Mei-Juni 2014
UC Onliner #5 - Mei-Juni 2014Nur Agustinus
 
Calculating building heights using a phone camera
Calculating building heights using a phone cameraCalculating building heights using a phone camera
Calculating building heights using a phone cameraRobin Hawkes
 
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataWebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataRobin Hawkes
 
Sw corporation (new)
Sw corporation (new)Sw corporation (new)
Sw corporation (new)Angelica ---
 
Session3 pl online_course_22_september2011
Session3  pl online_course_22_september2011Session3  pl online_course_22_september2011
Session3 pl online_course_22_september2011LeslieOflahavan
 

En vedette (20)

Rencana Pembentukan Program Studi Ekonomi ITB
Rencana Pembentukan Program Studi Ekonomi ITBRencana Pembentukan Program Studi Ekonomi ITB
Rencana Pembentukan Program Studi Ekonomi ITB
 
Windygallery's infographics 2011
Windygallery's infographics 2011Windygallery's infographics 2011
Windygallery's infographics 2011
 
Back To The Real World
Back To The Real WorldBack To The Real World
Back To The Real World
 
ESP- Summary of Services
ESP- Summary of ServicesESP- Summary of Services
ESP- Summary of Services
 
Learning Sessions #6 Residency Incubator Dance Source Houston
Learning Sessions #6 Residency Incubator   Dance Source HoustonLearning Sessions #6 Residency Incubator   Dance Source Houston
Learning Sessions #6 Residency Incubator Dance Source Houston
 
Periodical Exam Group 3
Periodical Exam Group 3Periodical Exam Group 3
Periodical Exam Group 3
 
ZinZin - Para Pengunjung Misterius
ZinZin - Para Pengunjung MisteriusZinZin - Para Pengunjung Misterius
ZinZin - Para Pengunjung Misterius
 
Kitab Pertama tentang Masa Kecil Yesus Kristus
Kitab Pertama tentang Masa Kecil Yesus KristusKitab Pertama tentang Masa Kecil Yesus Kristus
Kitab Pertama tentang Masa Kecil Yesus Kristus
 
How to Win People Heart & Mind
How to Win People Heart & MindHow to Win People Heart & Mind
How to Win People Heart & Mind
 
UC Onliner #5 - Mei-Juni 2014
UC Onliner #5 - Mei-Juni 2014UC Onliner #5 - Mei-Juni 2014
UC Onliner #5 - Mei-Juni 2014
 
Calculating building heights using a phone camera
Calculating building heights using a phone cameraCalculating building heights using a phone camera
Calculating building heights using a phone camera
 
Papiroflexia nueve figuras de papel 6 NIVEL BÁSICO
Papiroflexia nueve figuras de papel 6 NIVEL BÁSICOPapiroflexia nueve figuras de papel 6 NIVEL BÁSICO
Papiroflexia nueve figuras de papel 6 NIVEL BÁSICO
 
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataWebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
 
Sw corporation (new)
Sw corporation (new)Sw corporation (new)
Sw corporation (new)
 
Development evaluation (041115)
Development evaluation (041115)Development evaluation (041115)
Development evaluation (041115)
 
Majalah OMEGA
Majalah OMEGAMajalah OMEGA
Majalah OMEGA
 
Session3 pl online_course_22_september2011
Session3  pl online_course_22_september2011Session3  pl online_course_22_september2011
Session3 pl online_course_22_september2011
 
Epos Gilgamesh
Epos GilgameshEpos Gilgamesh
Epos Gilgamesh
 
eun
euneun
eun
 
EL UNIVERSO ENCENDIDO
EL UNIVERSO ENCENDIDOEL UNIVERSO ENCENDIDO
EL UNIVERSO ENCENDIDO
 

Similaire à MongoDB

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 MongoDBMongoDB
 
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
 Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDBMongoDB
 
Back to Basics Webinar 2 - Your First MongoDB Application
Back to  Basics Webinar 2 - Your First MongoDB ApplicationBack to  Basics Webinar 2 - Your First MongoDB Application
Back to Basics Webinar 2 - Your First MongoDB ApplicationJoe Drumgoole
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationMongoDB
 
Back to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB ApplicationBack to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB ApplicationJoe Drumgoole
 
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
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 
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
 
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop ConnectorAnalytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop ConnectorHenrik Ingo
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...MongoDB
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling rogerbodamer
 
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
 
Back to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBBack to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBMongoDB
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!Daniel Cousineau
 
Tame Accidental Complexity with Ruby and MongoMapper
Tame Accidental Complexity with Ruby and MongoMapperTame Accidental Complexity with Ruby and MongoMapper
Tame Accidental Complexity with Ruby and MongoMapperGiordano Scalzo
 
Starting with MongoDB
Starting with MongoDBStarting with MongoDB
Starting with MongoDBDoThinger
 
Inside PyMongo - MongoNYC
Inside PyMongo - MongoNYCInside PyMongo - MongoNYC
Inside PyMongo - MongoNYCMike Dirolf
 

Similaire à MongoDB (20)

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 With Style
MongoDB With StyleMongoDB With Style
MongoDB With Style
 
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
 Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
 
Back to Basics Webinar 2 - Your First MongoDB Application
Back to  Basics Webinar 2 - Your First MongoDB ApplicationBack to  Basics Webinar 2 - Your First MongoDB Application
Back to Basics Webinar 2 - Your First MongoDB Application
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB Application
 
Back to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB ApplicationBack to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB Application
 
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
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
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
 
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop ConnectorAnalytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop Connector
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling
 
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)
 
Back to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBBack to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDB
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
 
Tame Accidental Complexity with Ruby and MongoMapper
Tame Accidental Complexity with Ruby and MongoMapperTame Accidental Complexity with Ruby and MongoMapper
Tame Accidental Complexity with Ruby and MongoMapper
 
Starting with MongoDB
Starting with MongoDBStarting with MongoDB
Starting with MongoDB
 
Inside PyMongo - MongoNYC
Inside PyMongo - MongoNYCInside PyMongo - MongoNYC
Inside PyMongo - MongoNYC
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 

Plus de Rawin Windygallery

Plus de Rawin Windygallery (6)

Mobile application design trend & history
Mobile application design trend & historyMobile application design trend & history
Mobile application design trend & history
 
Deep web
Deep webDeep web
Deep web
 
Usabilities
UsabilitiesUsabilities
Usabilities
 
Love-stories.net statistic in Meeting#4
Love-stories.net statistic in Meeting#4Love-stories.net statistic in Meeting#4
Love-stories.net statistic in Meeting#4
 
Good behaviors
Good behaviorsGood behaviors
Good behaviors
 
Windygallery@molome
Windygallery@molomeWindygallery@molome
Windygallery@molome
 

Dernier

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
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
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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 StrategiesBoston Institute of Analytics
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
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
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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...Miguel Araújo
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Dernier (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
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
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
+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...
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
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...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

MongoDB

  • 1. MongoDB Rawin Viruchpintu Creative Technology Leader Spriiing Telecom Co.,Ltd. July 20, 2012
  • 2. Outline • MongoDB • Installation & start • Using Mongo
  • 3. • Document-oriented • Dynamic queries • Full dynamic index support • Efficient binary large-object storage • Built for speed • Replication and Auto-failover
  • 4. Installation & start • Download http://www.mongodb.org/downloads • Unzip into a folder for example /some/path/mongodb • Run $bin/mongod --dbpath=/some/path/mongodb
  • 5. Installation via Rails • $ gem install mongo Successfully installed mongo-1.6.4 1 gem installed Installing ri documentation for mongo-1.6.4... Installing RDoc documentation for mongo-1.6.4...
  • 6. Database structure • Separate DBs • Organized into Collections Top-level key -> Document • Collections – Group things into logical classes – Indexable by one or more keys – Schema-free!
  • 7. Database structure • Document – Always contains key_id – Creating Relationships: subdocument, shared key, or DBRef – Native storage and transfer: BSON • BSON – is a binary encoded serialization of JSON-like documents. http://bsonspec.org/
  • 8.
  • 9. Using Mongo D:mongodbbin>mongo MongoDB shell version: 2.0.6 connecting to: test > show dbs local (empty) test (empty) > use test switched to db test > db.test.find() > db.test.save({ name:'windy' , skills: 'blackberry, perl, php' }) > db.test.find() { "_id" : ObjectId("5008eb49839a10d95a068a01"), "name" : "windy", "skills" : "bl ackberry, perl, php" }
  • 10. Using Mongo >use things switched to db things >for ( var i=1; i<10; i++) db.things.save( {x: 'No.'+i, counter: i } ) >db.things.find() { "_id" : ObjectId("5008f81d839a10d95a068a02"), "x" : "No.1", "counter" : 1 } { "_id" : ObjectId("5008f81d839a10d95a068a03"), "x" : "No.2", "counter" : 2 } { "_id" : ObjectId("5008f81d839a10d95a068a04"), "x" : "No.3", "counter" : 3 } { "_id" : ObjectId("5008f81d839a10d95a068a05"), "x" : "No.4", "counter" : 4 } { "_id" : ObjectId("5008f81d839a10d95a068a06"), "x" : "No.5", "counter" : 5 } { "_id" : ObjectId("5008f81d839a10d95a068a07"), "x" : "No.6", "counter" : 6 } { "_id" : ObjectId("5008f81d839a10d95a068a08"), "x" : "No.7", "counter" : 7 } { "_id" : ObjectId("5008f81d839a10d95a068a09"), "x" : "No.8", "counter" : 8 } { "_id" : ObjectId("5008f81d839a10d95a068a0a"), "x" : "No.9", "counter" : 9 }
  • 11. Using Mongo > db.things.find({x: 'No.4'}) { "_id" : ObjectId("5008f81d839a10d95a068a05"), "x" : "No.4", "counter" : 4 } > db.things.find({x: 'No.33'}) > > db.things.find( { counter : { $gt : 5, $lte : 8} }) { "_id" : ObjectId("5008f81d839a10d95a068a07"), "x" : "No.6", "counter" : 6 } { "_id" : ObjectId("5008f81d839a10d95a068a08"), "x" : "No.7", "counter" : 7 } { "_id" : ObjectId("5008f81d839a10d95a068a09"), "x" : "No.8", "counter" : 8 }
  • 12. Using Mongo > show dbs local (empty) things 0.078125GB > use foo switched to db foo > db.foo.save( { name: 'windy', age: 18 } ) > db.foo.find() { "_id" : ObjectId("5008fa33839a10d95a068a0b"), "name" : "windy", "age" : 18 } > db.foo.update( {name: 'windy' }, { $set : { age : 21 } } ) > db.foo.find() { "_id" : ObjectId("5008fa33839a10d95a068a0b"), "name" : "windy", "age" : 21 }
  • 13. Using Mongo > db.foo.findOne( { name: 'windy'} ) { "_id" : ObjectId("5008fa33839a10d95a068a0b"), "name" : "windy", "age" : 21 }
  • 14. Using Mongo > use teams switched to db teams > db.teams.save({ team: 'A' , member : [ 'Kai'] }) > db.teams.find() { "_id" : ObjectId("5008fc13839a10d95a068a0c"), "team" : "A", "member" : [ "Kai” ] } > db.teams.update({ team: 'A' },{ $push : { member : 'Windy' } }) > db.teams.findOne() { "_id" : ObjectId("5008fc13839a10d95a068a0c"), "member" : [ "Kai", "Windy" ], “team" : "A" }
  • 15. Using Mongo > use simple switched to db simple > db.members.save( { name:"Windy", skill: ["java", "php"] } ) > db.teams.save({ team: 'A' }) Members Teams Windy Project A
  • 16. project_a = Using Mongo > windy = db.members.findOne( {name: "Windy"} ) { "_id" : ObjectId("50090510839a10d95a068a0f"), "name" : "Windy", "skill" : [ "java", "php" ] } > project_a = db.teams.findOne( { team : "A" } ) { "_id" : ObjectId("50090533839a10d95a068a10"), "team" : "A" } Project A Windywindy =
  • 17. Using Mongo > project_a.members = [] [ ] > project_a.members.push (new DBRef ('members', windy._id) ) 1 > db.teams.save(project_a) > project_a { "_id" : ObjectId("50090533839a10d95a068a10"), "team" : "A", "members" : [ { "$ref" : "members", "$id" : ObjectId("50090510839a10d95a068a0f") } ] } Project A windy = DBRef( ) Teams
  • 18. Using Mongo > project_a.members [ { "$ref" : "members", "$id" : ObjectId("50090510839a10d95a068a0f") } ] > project_a.members[0] { "$ref" : "members", "$id" : ObjectId("50090510839a10d95a068a0f") } > project_a.members[0].fetch() { "_id" : ObjectId("50090510839a10d95a068a0f"), "name" : "Windy", "skill" : [ "java", "php" ] }