SlideShare a Scribd company logo
1 of 17
MongoDB
(from “humongous”)




     Wouter de Vos – 2011-10-31
What is MongoDB?

•   A No-SQL database

•   Document oriented

•   Open Source

•   Written in C++
Document Oriented?

•   Documents are stored in collections   > db.posts.findOne()
                                          {
                                            _id : ObjectId("4e77bb3b8a3e000000004f7a"),
                                            when : Date("2011-09-19T02:10:11.3Z",
                                            author : "alex",


•
                                            title : "No Free Lunch",
    No JOINS: embedded                      text : "This is the text of the post. It could be very long.",
                                            tags : [ "business", "ramblings" ],
                                            votes : 5,
                                            voters : [ "jane", "joe", "spencer", "phyllis", "li" ],
                                            comments : [


•
                                              { who : "jane", when : Date("2011-09-19T04:00:10.112Z"),
    No JOINS: linked                            comment : "I agree." },
                                              { who : "meghan", when : Date("2011-09-20T14:36:06.958Z"),
                                                comment : "You must be joking. etc etc ..." }
                                            ]
                                          }
Document Oriented?

•   Documents are stored in collections   > db.posts.findOne()
                                          {
                                            _id : ObjectId("4e77bb3b8a3e000000004f7a"),
                                            when : Date("2011-09-19T02:10:11.3Z",
                                            author : "alex",


•
                                            title : "No Free Lunch",
    No JOINS: embedded                      text : "This is the text of the post. It could be very long.",
                                            tags : [ "business", "ramblings" ],
                                            votes : 5,
                                            voters : [ "jane", "joe", "spencer", "phyllis", "li" ],
                                            comments : [


•
                                              { who : "jane", when : Date("2011-09-19T04:00:10.112Z"),
    No JOINS: linked                            comment : "I agree." },
                                              { who : "meghan", when : Date("2011-09-20T14:36:06.958Z"),
                                                comment : "You must be joking. etc etc ..." }
                                            ]
                                          }
Document Oriented?

•   Documents are stored in collections
                                                      > db.posts.findOne()


•
                                                      {
    No JOINS: embedded                                  _id : ObjectId("4e77bb3b8a3e000000004f7a"),
                                                        when : Date("2011-09-19T02:10:11.3Z",
                                                        author : "alex",
                                                        title : "No Free Lunch",
                                                        text : "This is the text of the post. It could be very long.",


•
                                                        tags : [ "business", "ramblings" ],
    No JOINS: linked                                    votes : 5,
                                                        voters : [ "jane", "joe", "spencer", "phyllis", "li" ],
                                                        comments : [
                                                          { who : "jane", when : Date("2011-09-19T04:00:10.112Z"),
                                                            comment : "I agree." },


    •
                                                          { who : "meghan", when : Date("2011-09-20T14:36:06.958Z"),
        links are references to other documents and     ]
                                                            comment : "You must be joking. etc etc ..." }

        are processed by the client.                  }
Cool features
                                   > db.invoices.find()
                                   {

•   Schemaless
                                      _id : ObjectId("4e77bb3b8a3e000000004f7a"),
                                      client: "Johnson",
                                      hosting: {
                                         per: "month",


•
                                         price: 100,
    Atomic operations                 },
                                         amount: 12,

                                      development: {
                                         per: "hour",

•   Map/Reduce
                                      }
                                         price: 120,
                                         amount: 80

                                   },

•
                                   {
    Fast, in-place updates            _id : ObjectId("4e77bb3b8a3e000000005f7a"),
                                      client: "Black",
                                      development: {
                                         per: "hour",

•   GridFS
                                      }
                                         price: 120,
                                         amount: 30

                                   },
Cool features
•   Schemaless                     atomically {
                                     if( doc.credits > 5 ) {
                                       doc.credits -= 5;
•   Atomic operations                  doc.debits += 5;
                                     }
                                   }
•   Map/Reduce


•   Fast, in-place updates


•   GridFS
Cool features
                                 // Document example
                                 { username: "jones",
                                   likes: 20,
                                   text: "Hello world!"

•   Schemaless                   }

                                 // Map
                                 function() {

•   Atomic operations            }
                                   emit( this.username, {count: 1, likes: this.likes} );


                                 // Reduce

•
                                 function(key, values) {
    Map/Reduce                     var result = {count: 0, likes: 0};

                                     values.forEach(function(value) {
                                       result.count += value.count;

•   Fast, in-place updates             result.likes += value.likes;
                                     });

                                     return result;

•
                                 }
    GridFS
                                 // Result
                                 { count: 10, likes: 247 }
Cool features
•   Schemaless


•   Atomic operations
                               // In place update
                               db.recipes.update(

•   Map/Reduce
                               )
                                   {'_id': recipe_id, 'voters': {'$ne': user_id}},
                                   {'$inc': {'votes': 1}, '$push': {'voters': user_id}}




•   Fast, in-place updates


•   GridFS
Cool features
•   Schemaless


•   Atomic operations              The GridFS spec provides a mechanism for
                                transparently dividing a large file among multiple

•   Map/Reduce
                               documents. This allows us to efficiently store large
                                objects, and in the case of especially large files,
                                 such as videos, permits range operations (e.g.,
•   Fast, in-place updates           fetching only the first N bytes of a file).


•   GridFS
Querying
• // A post with title “Mongo”
  db.posts.find({'title': 'Mongo'})


• // All posts about tennis, but without comments
  db.posts.find( { tags : 'tennis' }, { comments : 0 } );


• // last 5 comments
  db.posts.find({}, {comments:{'$slice': -5}})


• // just the likes of the comments
  db.posts.find({}, {'comments.$.likes': 1}
Use it for

•   It’s schemaless features (e.g. for prototyping)

•   It’s horizontal scalability (with auto-sharding)

•   To store and stream large files (with gridfs)

•   To make ultra-fast, single query updates
Cucumber
Scenarios for browser testing
Feature: User Registration and Logging in
  A User should be able to create an account.
  A User should be able to log in with a new account.
  A User should be able to create a profile after logging in for the first time.

  Scenario: Registration with a normal account.
    Given I sign up as a new user with email@example.com/secret
    Then I should be signed in
    And I sign out

  Scenario: Log in with a new account
    Given I sign up as a new user with email@example.com/secret
    Then I should be signed in
    Then I sign out
    And I sign in with email@example.com/secret
    Then I should be signed in
    And I sign out

  Scenario: Create a profile with a new account
    Given I sign in as a new user
    Then I should see "create your profile"
    And I fill in "profile_name" with "My Name"
    And I fill in "profile_about" with "I am a long green vegetable that goes well with salads."
    And I select an avatar file
    And I press "Save"
    Then I should see "Profile was successfully updated."
    And I sign out
Step definitions in Ruby
Test Results
Mechanize, Selenium / Webkit


•   Mechanize: fast, but no javascript support

•   Selenium, javascript support, but sloooow

•   Webkit, javascript support, less slooow

More Related Content

What's hot

Schema design
Schema designSchema design
Schema designMongoDB
 
Learn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBLearn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBMarakana Inc.
 
Practical Ruby Projects (Alex Sharp)
Practical Ruby Projects (Alex Sharp)Practical Ruby Projects (Alex Sharp)
Practical Ruby Projects (Alex Sharp)MongoSF
 
Practical Ruby Projects with MongoDB - MongoSF
Practical Ruby Projects with MongoDB - MongoSFPractical Ruby Projects with MongoDB - MongoSF
Practical Ruby Projects with MongoDB - MongoSFAlex Sharp
 
CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009Jason Davies
 
Advanced Document Modeling Techniques from a High-Scale Commerce Platform
Advanced Document Modeling Techniques from a High-Scale Commerce PlatformAdvanced Document Modeling Techniques from a High-Scale Commerce Platform
Advanced Document Modeling Techniques from a High-Scale Commerce PlatformMongoDB
 
OSCON 2012 MongoDB Tutorial
OSCON 2012 MongoDB TutorialOSCON 2012 MongoDB Tutorial
OSCON 2012 MongoDB TutorialSteven Francia
 
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
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDCMike Dirolf
 
Graph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyGraph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyMark Needham
 
MongoDC 2012: How MongoDB Powers Doodle or Die
MongoDC 2012: How MongoDB Powers Doodle or DieMongoDC 2012: How MongoDB Powers Doodle or Die
MongoDC 2012: How MongoDB Powers Doodle or DieMongoDB
 
GraphConnect Europe 2016 - Building Spring Data Neo4j 4.1 Applications Like A...
GraphConnect Europe 2016 - Building Spring Data Neo4j 4.1 Applications Like A...GraphConnect Europe 2016 - Building Spring Data Neo4j 4.1 Applications Like A...
GraphConnect Europe 2016 - Building Spring Data Neo4j 4.1 Applications Like A...Neo4j
 
Dealing with Azure Cosmos DB
Dealing with Azure Cosmos DBDealing with Azure Cosmos DB
Dealing with Azure Cosmos DBMihail Mateev
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
MongoDB and Ruby on Rails
MongoDB and Ruby on RailsMongoDB and Ruby on Rails
MongoDB and Ruby on Railsrfischer20
 
Mongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or DieMongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or DieAaron Silverman
 

What's hot (20)

Schema design
Schema designSchema design
Schema design
 
Learn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBLearn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDB
 
Practical Ruby Projects (Alex Sharp)
Practical Ruby Projects (Alex Sharp)Practical Ruby Projects (Alex Sharp)
Practical Ruby Projects (Alex Sharp)
 
Practical Ruby Projects with MongoDB - MongoSF
Practical Ruby Projects with MongoDB - MongoSFPractical Ruby Projects with MongoDB - MongoSF
Practical Ruby Projects with MongoDB - MongoSF
 
CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009
 
Advanced Document Modeling Techniques from a High-Scale Commerce Platform
Advanced Document Modeling Techniques from a High-Scale Commerce PlatformAdvanced Document Modeling Techniques from a High-Scale Commerce Platform
Advanced Document Modeling Techniques from a High-Scale Commerce Platform
 
OSCON 2012 MongoDB Tutorial
OSCON 2012 MongoDB TutorialOSCON 2012 MongoDB Tutorial
OSCON 2012 MongoDB Tutorial
 
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
 
Schema Design
Schema DesignSchema Design
Schema Design
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
 
Graph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyGraph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easily
 
MongoDC 2012: How MongoDB Powers Doodle or Die
MongoDC 2012: How MongoDB Powers Doodle or DieMongoDC 2012: How MongoDB Powers Doodle or Die
MongoDC 2012: How MongoDB Powers Doodle or Die
 
MongoDB and hadoop
MongoDB and hadoopMongoDB and hadoop
MongoDB and hadoop
 
GraphConnect Europe 2016 - Building Spring Data Neo4j 4.1 Applications Like A...
GraphConnect Europe 2016 - Building Spring Data Neo4j 4.1 Applications Like A...GraphConnect Europe 2016 - Building Spring Data Neo4j 4.1 Applications Like A...
GraphConnect Europe 2016 - Building Spring Data Neo4j 4.1 Applications Like A...
 
Dealing with Azure Cosmos DB
Dealing with Azure Cosmos DBDealing with Azure Cosmos DB
Dealing with Azure Cosmos DB
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
MongoDB dessi-codemotion
MongoDB dessi-codemotionMongoDB dessi-codemotion
MongoDB dessi-codemotion
 
MongoDB and Ruby on Rails
MongoDB and Ruby on RailsMongoDB and Ruby on Rails
MongoDB and Ruby on Rails
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or DieMongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or Die
 

Viewers also liked

Identifying Antibiotics posing potential Health Risk: Microbial Resistance Sc...
Identifying Antibiotics posing potential Health Risk: Microbial Resistance Sc...Identifying Antibiotics posing potential Health Risk: Microbial Resistance Sc...
Identifying Antibiotics posing potential Health Risk: Microbial Resistance Sc...Atai Rabby
 
Tipos de biblioteca
Tipos de bibliotecaTipos de biblioteca
Tipos de bibliotecaVanesa Ovin
 
Анимационный ролик мир вокруг нас
Анимационный ролик мир вокруг насАнимационный ролик мир вокруг нас
Анимационный ролик мир вокруг насМарина Д
 
Expectativas turismo-2016-informe
Expectativas turismo-2016-informeExpectativas turismo-2016-informe
Expectativas turismo-2016-informeTuristenístico
 
The new comers
The new comersThe new comers
The new comersirongate55
 
Community health & wellness fest 2015
Community health & wellness fest 2015Community health & wellness fest 2015
Community health & wellness fest 2015Mary Phillips
 
Pdf slide show
Pdf slide showPdf slide show
Pdf slide showyawarete
 
Small Biz CEDC Orientation
Small Biz CEDC OrientationSmall Biz CEDC Orientation
Small Biz CEDC OrientationMary Phillips
 
Tweaking Open Source
Tweaking Open SourceTweaking Open Source
Tweaking Open SourceNelson Gomes
 
Cinco claves de los mercados hoteleros de Madrid y Barcelona 2016
Cinco claves de los mercados hoteleros de Madrid y Barcelona 2016Cinco claves de los mercados hoteleros de Madrid y Barcelona 2016
Cinco claves de los mercados hoteleros de Madrid y Barcelona 2016Turistenístico
 
Don't Write Them Off, Cast Iron Boilers Still Have a Future
Don't Write Them Off, Cast Iron Boilers Still Have a FutureDon't Write Them Off, Cast Iron Boilers Still Have a Future
Don't Write Them Off, Cast Iron Boilers Still Have a FutureBuildingMech
 
台北國際烘焙暨設備展New
台北國際烘焙暨設備展New台北國際烘焙暨設備展New
台北國際烘焙暨設備展NewEVERY8D 許
 
The Future of Travel in 2020
The Future of Travel in 2020The Future of Travel in 2020
The Future of Travel in 2020Turistenístico
 
Small biz expo & suit donation for the homeless
Small biz expo & suit donation for the homelessSmall biz expo & suit donation for the homeless
Small biz expo & suit donation for the homelessMary Phillips
 

Viewers also liked (20)

Identifying Antibiotics posing potential Health Risk: Microbial Resistance Sc...
Identifying Antibiotics posing potential Health Risk: Microbial Resistance Sc...Identifying Antibiotics posing potential Health Risk: Microbial Resistance Sc...
Identifying Antibiotics posing potential Health Risk: Microbial Resistance Sc...
 
Tipos de biblioteca
Tipos de bibliotecaTipos de biblioteca
Tipos de biblioteca
 
Rph Ringkas
Rph RingkasRph Ringkas
Rph Ringkas
 
Анимационный ролик мир вокруг нас
Анимационный ролик мир вокруг насАнимационный ролик мир вокруг нас
Анимационный ролик мир вокруг нас
 
Expectativas turismo-2016-informe
Expectativas turismo-2016-informeExpectativas turismo-2016-informe
Expectativas turismo-2016-informe
 
The new comers
The new comersThe new comers
The new comers
 
Community health & wellness fest 2015
Community health & wellness fest 2015Community health & wellness fest 2015
Community health & wellness fest 2015
 
кораблик
корабликкораблик
кораблик
 
Pdf slide show
Pdf slide showPdf slide show
Pdf slide show
 
L
LL
L
 
Presentatie2 versie2b
Presentatie2 versie2bPresentatie2 versie2b
Presentatie2 versie2b
 
Small Biz CEDC Orientation
Small Biz CEDC OrientationSmall Biz CEDC Orientation
Small Biz CEDC Orientation
 
Tweaking Open Source
Tweaking Open SourceTweaking Open Source
Tweaking Open Source
 
Cinco claves de los mercados hoteleros de Madrid y Barcelona 2016
Cinco claves de los mercados hoteleros de Madrid y Barcelona 2016Cinco claves de los mercados hoteleros de Madrid y Barcelona 2016
Cinco claves de los mercados hoteleros de Madrid y Barcelona 2016
 
Don't Write Them Off, Cast Iron Boilers Still Have a Future
Don't Write Them Off, Cast Iron Boilers Still Have a FutureDon't Write Them Off, Cast Iron Boilers Still Have a Future
Don't Write Them Off, Cast Iron Boilers Still Have a Future
 
1
11
1
 
Gaya gerak listrik
Gaya gerak listrikGaya gerak listrik
Gaya gerak listrik
 
台北國際烘焙暨設備展New
台北國際烘焙暨設備展New台北國際烘焙暨設備展New
台北國際烘焙暨設備展New
 
The Future of Travel in 2020
The Future of Travel in 2020The Future of Travel in 2020
The Future of Travel in 2020
 
Small biz expo & suit donation for the homeless
Small biz expo & suit donation for the homelessSmall biz expo & suit donation for the homeless
Small biz expo & suit donation for the homeless
 

Similar to Springest Dev Lunch: MongoDB Introduction

Managing Social Content with MongoDB
Managing Social Content with MongoDBManaging Social Content with MongoDB
Managing Social Content with MongoDBMongoDB
 
Mongodb intro
Mongodb introMongodb intro
Mongodb introchristkv
 
Schema design
Schema designSchema design
Schema designchristkv
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012hungarianhc
 
2011 mongo sf-schemadesign
2011 mongo sf-schemadesign2011 mongo sf-schemadesign
2011 mongo sf-schemadesignMongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBNeil Henegan
 
Why NoSQL Makes Sense
Why NoSQL Makes SenseWhy NoSQL Makes Sense
Why NoSQL Makes SenseMongoDB
 
Why NoSQL Makes Sense
Why NoSQL Makes SenseWhy NoSQL Makes Sense
Why NoSQL Makes SenseMongoDB
 
SDEC2011 NoSQL Data modelling
SDEC2011 NoSQL Data modellingSDEC2011 NoSQL Data modelling
SDEC2011 NoSQL Data modellingKorea Sdec
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDBMongoDB
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsKorea Sdec
 
Webinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsWebinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsMongoDB
 
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsThe Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsMatias Cascallares
 

Similar to Springest Dev Lunch: MongoDB Introduction (20)

Managing Social Content with MongoDB
Managing Social Content with MongoDBManaging Social Content with MongoDB
Managing Social Content with MongoDB
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
MongoDB at GUL
MongoDB at GULMongoDB at GUL
MongoDB at GUL
 
Mongo db presentation
Mongo db presentationMongo db presentation
Mongo db presentation
 
Schema design
Schema designSchema design
Schema design
 
Meetup#2: MongoDB Schema Design
Meetup#2: MongoDB Schema DesignMeetup#2: MongoDB Schema Design
Meetup#2: MongoDB Schema Design
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012
 
2011 mongo sf-schemadesign
2011 mongo sf-schemadesign2011 mongo sf-schemadesign
2011 mongo sf-schemadesign
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
mongoDB at Visibiz
mongoDB at VisibizmongoDB at Visibiz
mongoDB at Visibiz
 
Why NoSQL Makes Sense
Why NoSQL Makes SenseWhy NoSQL Makes Sense
Why NoSQL Makes Sense
 
Why NoSQL Makes Sense
Why NoSQL Makes SenseWhy NoSQL Makes Sense
Why NoSQL Makes Sense
 
SDEC2011 NoSQL Data modelling
SDEC2011 NoSQL Data modellingSDEC2011 NoSQL Data modelling
SDEC2011 NoSQL Data modelling
 
Latinoware
LatinowareLatinoware
Latinoware
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and models
 
Webinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsWebinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in Documents
 
SQL vs NoSQL
SQL vs NoSQLSQL vs NoSQL
SQL vs NoSQL
 
MongoDB at RuPy
MongoDB at RuPyMongoDB at RuPy
MongoDB at RuPy
 
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsThe Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
 

Recently uploaded

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

Springest Dev Lunch: MongoDB Introduction

  • 1. MongoDB (from “humongous”) Wouter de Vos – 2011-10-31
  • 2. What is MongoDB? • A No-SQL database • Document oriented • Open Source • Written in C++
  • 3. Document Oriented? • Documents are stored in collections > db.posts.findOne() { _id : ObjectId("4e77bb3b8a3e000000004f7a"), when : Date("2011-09-19T02:10:11.3Z", author : "alex", • title : "No Free Lunch", No JOINS: embedded text : "This is the text of the post. It could be very long.", tags : [ "business", "ramblings" ], votes : 5, voters : [ "jane", "joe", "spencer", "phyllis", "li" ], comments : [ • { who : "jane", when : Date("2011-09-19T04:00:10.112Z"), No JOINS: linked comment : "I agree." }, { who : "meghan", when : Date("2011-09-20T14:36:06.958Z"), comment : "You must be joking. etc etc ..." } ] }
  • 4. Document Oriented? • Documents are stored in collections > db.posts.findOne() { _id : ObjectId("4e77bb3b8a3e000000004f7a"), when : Date("2011-09-19T02:10:11.3Z", author : "alex", • title : "No Free Lunch", No JOINS: embedded text : "This is the text of the post. It could be very long.", tags : [ "business", "ramblings" ], votes : 5, voters : [ "jane", "joe", "spencer", "phyllis", "li" ], comments : [ • { who : "jane", when : Date("2011-09-19T04:00:10.112Z"), No JOINS: linked comment : "I agree." }, { who : "meghan", when : Date("2011-09-20T14:36:06.958Z"), comment : "You must be joking. etc etc ..." } ] }
  • 5. Document Oriented? • Documents are stored in collections > db.posts.findOne() • { No JOINS: embedded _id : ObjectId("4e77bb3b8a3e000000004f7a"), when : Date("2011-09-19T02:10:11.3Z", author : "alex", title : "No Free Lunch", text : "This is the text of the post. It could be very long.", • tags : [ "business", "ramblings" ], No JOINS: linked votes : 5, voters : [ "jane", "joe", "spencer", "phyllis", "li" ], comments : [ { who : "jane", when : Date("2011-09-19T04:00:10.112Z"), comment : "I agree." }, • { who : "meghan", when : Date("2011-09-20T14:36:06.958Z"), links are references to other documents and ] comment : "You must be joking. etc etc ..." } are processed by the client. }
  • 6. Cool features > db.invoices.find() { • Schemaless _id : ObjectId("4e77bb3b8a3e000000004f7a"), client: "Johnson", hosting: { per: "month", • price: 100, Atomic operations }, amount: 12, development: { per: "hour", • Map/Reduce } price: 120, amount: 80 }, • { Fast, in-place updates _id : ObjectId("4e77bb3b8a3e000000005f7a"), client: "Black", development: { per: "hour", • GridFS } price: 120, amount: 30 },
  • 7. Cool features • Schemaless atomically { if( doc.credits > 5 ) { doc.credits -= 5; • Atomic operations doc.debits += 5; } } • Map/Reduce • Fast, in-place updates • GridFS
  • 8. Cool features // Document example { username: "jones", likes: 20, text: "Hello world!" • Schemaless } // Map function() { • Atomic operations } emit( this.username, {count: 1, likes: this.likes} ); // Reduce • function(key, values) { Map/Reduce var result = {count: 0, likes: 0}; values.forEach(function(value) { result.count += value.count; • Fast, in-place updates result.likes += value.likes; }); return result; • } GridFS // Result { count: 10, likes: 247 }
  • 9. Cool features • Schemaless • Atomic operations // In place update db.recipes.update( • Map/Reduce ) {'_id': recipe_id, 'voters': {'$ne': user_id}}, {'$inc': {'votes': 1}, '$push': {'voters': user_id}} • Fast, in-place updates • GridFS
  • 10. Cool features • Schemaless • Atomic operations The GridFS spec provides a mechanism for transparently dividing a large file among multiple • Map/Reduce documents. This allows us to efficiently store large objects, and in the case of especially large files, such as videos, permits range operations (e.g., • Fast, in-place updates fetching only the first N bytes of a file). • GridFS
  • 11. Querying • // A post with title “Mongo” db.posts.find({'title': 'Mongo'}) • // All posts about tennis, but without comments db.posts.find( { tags : 'tennis' }, { comments : 0 } ); • // last 5 comments db.posts.find({}, {comments:{'$slice': -5}}) • // just the likes of the comments db.posts.find({}, {'comments.$.likes': 1}
  • 12. Use it for • It’s schemaless features (e.g. for prototyping) • It’s horizontal scalability (with auto-sharding) • To store and stream large files (with gridfs) • To make ultra-fast, single query updates
  • 14. Scenarios for browser testing Feature: User Registration and Logging in A User should be able to create an account. A User should be able to log in with a new account. A User should be able to create a profile after logging in for the first time. Scenario: Registration with a normal account. Given I sign up as a new user with email@example.com/secret Then I should be signed in And I sign out Scenario: Log in with a new account Given I sign up as a new user with email@example.com/secret Then I should be signed in Then I sign out And I sign in with email@example.com/secret Then I should be signed in And I sign out Scenario: Create a profile with a new account Given I sign in as a new user Then I should see "create your profile" And I fill in "profile_name" with "My Name" And I fill in "profile_about" with "I am a long green vegetable that goes well with salads." And I select an avatar file And I press "Save" Then I should see "Profile was successfully updated." And I sign out
  • 17. Mechanize, Selenium / Webkit • Mechanize: fast, but no javascript support • Selenium, javascript support, but sloooow • Webkit, javascript support, less slooow

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n