SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
MongoDB      Forward Tech Away Day 24 Sep 2010

                                   toni@forward.co.uk




Monday, 27 September 2010
1
  Get to know
  MongoDB
Monday, 27 September 2010
try.mongodb.org




Monday, 27 September 2010
Ruby driver
          require 'rubygems'
          require 'mongo'

          @db = Mongo::Connection.new.db("blog")

          @blogposts = @db['blogposts']




Monday, 27 September 2010
a simple document

               post = {
                 :time => Time.now.utc,
                 :title => "Simple Post",
               }

               @blogposts << blogpost




Monday, 27 September 2010
When we call #save:
               1. Adds an _id
               2. Serialise to BSON
               3. socket.send()


Monday, 27 September 2010
2
  Use rich
  documents
Monday, 27 September 2010
“complex objects”
     blogpost = {
       :title => "My First Post",
       :author => {:name => "Jane"},
       :comments => [{ :by => "Abe", :text => "First" },
                    { :by => "Ada", :text => "Good post" }]
     }

     @blogposts.save(blogpost)




Monday, 27 September 2010
“complex objects”
     blogpost = {
       :title => "My First Post",
       :time => Time.now.utc,
       :author => {:name => "Jane"},
       :views => 0,
       :languages => ["English", "Italian", "Spanish"],
         :comments => [{ :by => "Abe",
          :text => "First", :vote => 1, :date => Time.now.utc }]
     }



     @blogposts.save(blogpost)




Monday, 27 September 2010
dynamic queries
     @blogposts.find( { "author.name" => "Jane" } )


     @blogposts.find( { "author.name" => /^J/ } )


     @blogposts.find( { :time =>
       {'$lte' => Time.utc(1970,1,1)} } )


     @blogposts.find( { :languages => {'$in' =>
       ["English", "Italian"] } } )




Monday, 27 September 2010
find and modify!
         cmd = BSON::OrderedHash.new
         cmd[:findandmodify] = 'blogposts'
         cmd[:query] = { :title => "My First Post" }
         cmd[:update] = { '$set' =>
                             { :title => "My First Post updated"}}
         DB.command(cmd)




Monday, 27 September 2010
upsert

       @blogposts.update({:title => "My First Post"}, blogpost,
         { :upsert => true })




Monday, 27 September 2010
update
          @blogposts.update({:title => "My First Post"}, blogpost)

          @blogposts.update(
            {:title => "My First Post"}, {'$inc' => {"views" => 1}})




Monday, 27 September 2010
query operators

                            "$ne"       "$inc"
                            "$in"       "$set"
                            "$nin"      "$push"
                            "$mod"      "$pushAll"
                            "$all"      "$pop"
                            "$size"     "$pull"
                            "$exists"   "$pullAll"




Monday, 27 September 2010
3
  Map reduce for
  aggregation
Monday, 27 September 2010
map reduce
         def self.target_for_report(report)
           collections = DB['targets'].group(['metric'],
             { :report_type => report.report_type,
               :project_name => report.project },
             { 'docs' => [] },
             "function(doc, prev) { prev.docs.push(doc); }");
         end




Monday, 27 September 2010
4
  Indexes are
  indexes
Monday, 27 September 2010
indexes
     @blogposts.create_index([[ "comments.by" ,                            Mongo::ASCENDING ]]);
                            db.blogposts.ensureIndex( { "comments.by" : 1 } );


     @blogposts.create_index([[ :languages ,                         Mongo::ASCENDING ]]);

     @blogposts.create_index([[ :time ,                    Mongo::DESCENDING ]]);

     @blogposts.create_index([[ :author ,                      Mongo::ASCENDING, true ]]);

     @blogposts.create_index(
       [[ "comments.vote" , 1,], [ "comments.date", -1 ]]);




Monday, 27 September 2010
5
  GridFS
Monday, 27 September 2010
api
                grid = Mongo::Grid.new(DB)
                my_avatar = File.open('toni.jpg','r')
                id = grid.put(my_avatar)




               files collection for metadata
               chunks collection for data



Monday, 27 September 2010
6
 Replication
Monday, 27 September 2010
m/s vs replica set



   asynchronous replication of data between servers for failover and redundancy

   only one server (in the set/shard) is active for writes (the primary, or master) at
   a given time.




Monday, 27 September 2010
replica sets (1.6+)

                   • Supports 1-7 servers in the cluster
                   • Automatic failover
                   • Automatic recovery


Monday, 27 September 2010
7
  Auto-shard
Monday, 27 September 2010
mongo shards




              Sharding occurs on a per-collection basis




Monday, 27 September 2010
8
  Pro & Cons
Monday, 27 September 2010
pro & cons

                   • schema free > no migrations needed
                   • no sql
                   • update existing data
                   • stable
                   • very nice api

Monday, 27 September 2010
good for

                   • the web
                   • real time
                   • logging
                   • analytics
                   • humans

Monday, 27 September 2010
9
  Links
Monday, 27 September 2010
links

                   • http://api.mongodb.org/ruby/1.0.9/
                            index.html
                   • http://www.mongodb.org/
                   • http://mongoid.org/


Monday, 27 September 2010
10
  Questions
Monday, 27 September 2010

Weitere ähnliche Inhalte

Was ist angesagt?

Best Practices - Mobile Developer Summit
Best Practices - Mobile Developer SummitBest Practices - Mobile Developer Summit
Best Practices - Mobile Developer Summitwolframkriesing
 
Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発swdyh
 
Learn JS concepts by implementing jQuery
Learn JS concepts by implementing jQueryLearn JS concepts by implementing jQuery
Learn JS concepts by implementing jQueryWingify Engineering
 
Drupal 7: What's In It For You?
Drupal 7: What's In It For You?Drupal 7: What's In It For You?
Drupal 7: What's In It For You?karschsp
 
State of jQuery and Drupal
State of jQuery and DrupalState of jQuery and Drupal
State of jQuery and Drupaljeresig
 

Was ist angesagt? (7)

Best Practices - Mobile Developer Summit
Best Practices - Mobile Developer SummitBest Practices - Mobile Developer Summit
Best Practices - Mobile Developer Summit
 
Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発
 
Yuihacku iitd-sumana
Yuihacku iitd-sumanaYuihacku iitd-sumana
Yuihacku iitd-sumana
 
Learn JS concepts by implementing jQuery
Learn JS concepts by implementing jQueryLearn JS concepts by implementing jQuery
Learn JS concepts by implementing jQuery
 
API Design
API DesignAPI Design
API Design
 
Drupal 7: What's In It For You?
Drupal 7: What's In It For You?Drupal 7: What's In It For You?
Drupal 7: What's In It For You?
 
State of jQuery and Drupal
State of jQuery and DrupalState of jQuery and Drupal
State of jQuery and Drupal
 

Andere mochten auch

SASPAC 2011 and beyond - BURISA Conference 13.05.11
SASPAC 2011 and beyond - BURISA Conference 13.05.11SASPAC 2011 and beyond - BURISA Conference 13.05.11
SASPAC 2011 and beyond - BURISA Conference 13.05.11alewis
 
Blend it up - leancamp london presentation
Blend it up - leancamp london presentationBlend it up - leancamp london presentation
Blend it up - leancamp london presentationAntonio Terreno
 
Festa Dei Sozzi
Festa Dei SozziFesta Dei Sozzi
Festa Dei Sozzialdamith
 
在Sae上开发高性能微博应用
在Sae上开发高性能微博应用在Sae上开发高性能微博应用
在Sae上开发高性能微博应用easychen
 
Rachel & Richards Wedding Slide Show
Rachel & Richards Wedding Slide ShowRachel & Richards Wedding Slide Show
Rachel & Richards Wedding Slide Showisraelmosheh
 
Autotools
Autotools Autotools
Autotools easychen
 
Publizitatearen Historia 3gaia2/3zatia
Publizitatearen Historia 3gaia2/3zatiaPublizitatearen Historia 3gaia2/3zatia
Publizitatearen Historia 3gaia2/3zatiakatixa
 
Team Work!!!
Team Work!!!Team Work!!!
Team Work!!!Guddi
 
Presentatie Mariska van Zelst-de Wit Masterclass Open Cultuur Data
Presentatie Mariska van Zelst-de Wit Masterclass Open Cultuur DataPresentatie Mariska van Zelst-de Wit Masterclass Open Cultuur Data
Presentatie Mariska van Zelst-de Wit Masterclass Open Cultuur DataKennisland
 
Ict4volunteering Mv
Ict4volunteering MvIct4volunteering Mv
Ict4volunteering Mvhavs
 
2011 Ons Data Workshop (20.3.07)
2011 Ons Data Workshop (20.3.07)2011 Ons Data Workshop (20.3.07)
2011 Ons Data Workshop (20.3.07)alewis
 
Asbury Hadoop Overview
Asbury Hadoop OverviewAsbury Hadoop Overview
Asbury Hadoop OverviewBrian Enochson
 
Ocd workshop de_effecten_van_ocd
Ocd workshop de_effecten_van_ocdOcd workshop de_effecten_van_ocd
Ocd workshop de_effecten_van_ocdKennisland
 

Andere mochten auch (16)

SASPAC 2011 and beyond - BURISA Conference 13.05.11
SASPAC 2011 and beyond - BURISA Conference 13.05.11SASPAC 2011 and beyond - BURISA Conference 13.05.11
SASPAC 2011 and beyond - BURISA Conference 13.05.11
 
Blend it up - leancamp london presentation
Blend it up - leancamp london presentationBlend it up - leancamp london presentation
Blend it up - leancamp london presentation
 
Festa Dei Sozzi
Festa Dei SozziFesta Dei Sozzi
Festa Dei Sozzi
 
Artalk
ArtalkArtalk
Artalk
 
Gno
GnoGno
Gno
 
在Sae上开发高性能微博应用
在Sae上开发高性能微博应用在Sae上开发高性能微博应用
在Sae上开发高性能微博应用
 
Rachel & Richards Wedding Slide Show
Rachel & Richards Wedding Slide ShowRachel & Richards Wedding Slide Show
Rachel & Richards Wedding Slide Show
 
Autotools
Autotools Autotools
Autotools
 
Publizitatearen Historia 3gaia2/3zatia
Publizitatearen Historia 3gaia2/3zatiaPublizitatearen Historia 3gaia2/3zatia
Publizitatearen Historia 3gaia2/3zatia
 
UX Must Die
UX Must DieUX Must Die
UX Must Die
 
Team Work!!!
Team Work!!!Team Work!!!
Team Work!!!
 
Presentatie Mariska van Zelst-de Wit Masterclass Open Cultuur Data
Presentatie Mariska van Zelst-de Wit Masterclass Open Cultuur DataPresentatie Mariska van Zelst-de Wit Masterclass Open Cultuur Data
Presentatie Mariska van Zelst-de Wit Masterclass Open Cultuur Data
 
Ict4volunteering Mv
Ict4volunteering MvIct4volunteering Mv
Ict4volunteering Mv
 
2011 Ons Data Workshop (20.3.07)
2011 Ons Data Workshop (20.3.07)2011 Ons Data Workshop (20.3.07)
2011 Ons Data Workshop (20.3.07)
 
Asbury Hadoop Overview
Asbury Hadoop OverviewAsbury Hadoop Overview
Asbury Hadoop Overview
 
Ocd workshop de_effecten_van_ocd
Ocd workshop de_effecten_van_ocdOcd workshop de_effecten_van_ocd
Ocd workshop de_effecten_van_ocd
 

Ähnlich wie Mongo db

Continuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using HudsonContinuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using HudsonEric Steele
 
Mongodb on Ruby And Rails (froscon 2010)
Mongodb on Ruby And Rails (froscon 2010)Mongodb on Ruby And Rails (froscon 2010)
Mongodb on Ruby And Rails (froscon 2010)jan_mindmatters
 
MongoDB on Rails (and Ruby)
MongoDB on Rails (and Ruby)MongoDB on Rails (and Ruby)
MongoDB on Rails (and Ruby)jan_mindmatters
 
SQLite Techniques
SQLite TechniquesSQLite Techniques
SQLite Techniquesjoaopmaia
 
Campus Party 2010
Campus Party 2010Campus Party 2010
Campus Party 2010Fabio Akita
 
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...boychatmate1
 
Backbone.js - Michał Taberski (PRUG 2.0)
Backbone.js - Michał Taberski (PRUG 2.0)Backbone.js - Michał Taberski (PRUG 2.0)
Backbone.js - Michał Taberski (PRUG 2.0)ecommerce poland expo
 
MongoDB at RubyEnRails 2009
MongoDB at RubyEnRails 2009MongoDB at RubyEnRails 2009
MongoDB at RubyEnRails 2009Mike Dirolf
 
Ruby on-rails-workshop
Ruby on-rails-workshopRuby on-rails-workshop
Ruby on-rails-workshopRyan Abbott
 
Intro to mongodb mongouk jun2010
Intro to mongodb mongouk jun2010Intro to mongodb mongouk jun2010
Intro to mongodb mongouk jun2010Skills Matter
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDBNate Abele
 
The Tech Side of Project Argo
The Tech Side of Project ArgoThe Tech Side of Project Argo
The Tech Side of Project ArgoWesley Lindamood
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRailsMike Dirolf
 
Marc s01 e02-crud-database
Marc s01 e02-crud-databaseMarc s01 e02-crud-database
Marc s01 e02-crud-databaseMongoDB
 
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...MongoDB
 
Kon nichi wa_ruby
Kon nichi wa_rubyKon nichi wa_ruby
Kon nichi wa_rubyScott Motte
 
Creating a Single View Part 2: Loading Disparate Source Data and Creating a S...
Creating a Single View Part 2: Loading Disparate Source Data and Creating a S...Creating a Single View Part 2: Loading Disparate Source Data and Creating a S...
Creating a Single View Part 2: Loading Disparate Source Data and Creating a S...MongoDB
 

Ähnlich wie Mongo db (20)

Continuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using HudsonContinuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using Hudson
 
Mongodb on Ruby And Rails (froscon 2010)
Mongodb on Ruby And Rails (froscon 2010)Mongodb on Ruby And Rails (froscon 2010)
Mongodb on Ruby And Rails (froscon 2010)
 
MongoDB on Rails (and Ruby)
MongoDB on Rails (and Ruby)MongoDB on Rails (and Ruby)
MongoDB on Rails (and Ruby)
 
SQLite Techniques
SQLite TechniquesSQLite Techniques
SQLite Techniques
 
Campus Party 2010
Campus Party 2010Campus Party 2010
Campus Party 2010
 
Mongodb railscamphh
Mongodb railscamphhMongodb railscamphh
Mongodb railscamphh
 
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
 
Backbone.js - Michał Taberski (PRUG 2.0)
Backbone.js - Michał Taberski (PRUG 2.0)Backbone.js - Michał Taberski (PRUG 2.0)
Backbone.js - Michał Taberski (PRUG 2.0)
 
MongoDB at RubyEnRails 2009
MongoDB at RubyEnRails 2009MongoDB at RubyEnRails 2009
MongoDB at RubyEnRails 2009
 
MongoDB
MongoDBMongoDB
MongoDB
 
Ruby on-rails-workshop
Ruby on-rails-workshopRuby on-rails-workshop
Ruby on-rails-workshop
 
Intro to mongodb mongouk jun2010
Intro to mongodb mongouk jun2010Intro to mongodb mongouk jun2010
Intro to mongodb mongouk jun2010
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
 
The Tech Side of Project Argo
The Tech Side of Project ArgoThe Tech Side of Project Argo
The Tech Side of Project Argo
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRails
 
Marc s01 e02-crud-database
Marc s01 e02-crud-databaseMarc s01 e02-crud-database
Marc s01 e02-crud-database
 
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
 
MongoDB at RuPy
MongoDB at RuPyMongoDB at RuPy
MongoDB at RuPy
 
Kon nichi wa_ruby
Kon nichi wa_rubyKon nichi wa_ruby
Kon nichi wa_ruby
 
Creating a Single View Part 2: Loading Disparate Source Data and Creating a S...
Creating a Single View Part 2: Loading Disparate Source Data and Creating a S...Creating a Single View Part 2: Loading Disparate Source Data and Creating a S...
Creating a Single View Part 2: Loading Disparate Source Data and Creating a S...
 

Mehr von Antonio Terreno

Serverless conference-labrador-at-2018
Serverless conference-labrador-at-2018Serverless conference-labrador-at-2018
Serverless conference-labrador-at-2018Antonio Terreno
 
Agiler without a schema @forward
Agiler without a schema @forwardAgiler without a schema @forward
Agiler without a schema @forwardAntonio Terreno
 
J2Me Il Micro Mondo Java
J2Me Il Micro Mondo JavaJ2Me Il Micro Mondo Java
J2Me Il Micro Mondo JavaAntonio Terreno
 
Domain Driven Design Javaday Roma2007
Domain Driven Design Javaday Roma2007Domain Driven Design Javaday Roma2007
Domain Driven Design Javaday Roma2007Antonio Terreno
 
Jc06 Antonio Terreno Fluidtime
Jc06 Antonio Terreno FluidtimeJc06 Antonio Terreno Fluidtime
Jc06 Antonio Terreno FluidtimeAntonio Terreno
 
From Amber To Green in Four Weeks
From Amber To Green in Four WeeksFrom Amber To Green in Four Weeks
From Amber To Green in Four WeeksAntonio Terreno
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being DrivenAntonio Terreno
 

Mehr von Antonio Terreno (11)

Serverless conference-labrador-at-2018
Serverless conference-labrador-at-2018Serverless conference-labrador-at-2018
Serverless conference-labrador-at-2018
 
Programmer Anarchy
Programmer AnarchyProgrammer Anarchy
Programmer Anarchy
 
Socket.io
Socket.ioSocket.io
Socket.io
 
Agiler without a schema @forward
Agiler without a schema @forwardAgiler without a schema @forward
Agiler without a schema @forward
 
J2Me Il Micro Mondo Java
J2Me Il Micro Mondo JavaJ2Me Il Micro Mondo Java
J2Me Il Micro Mondo Java
 
Domain Driven Design Javaday Roma2007
Domain Driven Design Javaday Roma2007Domain Driven Design Javaday Roma2007
Domain Driven Design Javaday Roma2007
 
Jc06 Antonio Terreno Fluidtime
Jc06 Antonio Terreno FluidtimeJc06 Antonio Terreno Fluidtime
Jc06 Antonio Terreno Fluidtime
 
Kommons
KommonsKommons
Kommons
 
From Amber To Green in Four Weeks
From Amber To Green in Four WeeksFrom Amber To Green in Four Weeks
From Amber To Green in Four Weeks
 
Time Boxing
Time BoxingTime Boxing
Time Boxing
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 

Mongo db

  • 1. MongoDB Forward Tech Away Day 24 Sep 2010 toni@forward.co.uk Monday, 27 September 2010
  • 2. 1 Get to know MongoDB Monday, 27 September 2010
  • 4. Ruby driver require 'rubygems' require 'mongo' @db = Mongo::Connection.new.db("blog") @blogposts = @db['blogposts'] Monday, 27 September 2010
  • 5. a simple document post = { :time => Time.now.utc, :title => "Simple Post", } @blogposts << blogpost Monday, 27 September 2010
  • 6. When we call #save: 1. Adds an _id 2. Serialise to BSON 3. socket.send() Monday, 27 September 2010
  • 7. 2 Use rich documents Monday, 27 September 2010
  • 8. “complex objects” blogpost = { :title => "My First Post", :author => {:name => "Jane"}, :comments => [{ :by => "Abe", :text => "First" }, { :by => "Ada", :text => "Good post" }] } @blogposts.save(blogpost) Monday, 27 September 2010
  • 9. “complex objects” blogpost = { :title => "My First Post", :time => Time.now.utc, :author => {:name => "Jane"}, :views => 0, :languages => ["English", "Italian", "Spanish"], :comments => [{ :by => "Abe", :text => "First", :vote => 1, :date => Time.now.utc }] } @blogposts.save(blogpost) Monday, 27 September 2010
  • 10. dynamic queries @blogposts.find( { "author.name" => "Jane" } ) @blogposts.find( { "author.name" => /^J/ } ) @blogposts.find( { :time => {'$lte' => Time.utc(1970,1,1)} } ) @blogposts.find( { :languages => {'$in' => ["English", "Italian"] } } ) Monday, 27 September 2010
  • 11. find and modify! cmd = BSON::OrderedHash.new cmd[:findandmodify] = 'blogposts' cmd[:query] = { :title => "My First Post" } cmd[:update] = { '$set' => { :title => "My First Post updated"}} DB.command(cmd) Monday, 27 September 2010
  • 12. upsert @blogposts.update({:title => "My First Post"}, blogpost, { :upsert => true }) Monday, 27 September 2010
  • 13. update @blogposts.update({:title => "My First Post"}, blogpost) @blogposts.update( {:title => "My First Post"}, {'$inc' => {"views" => 1}}) Monday, 27 September 2010
  • 14. query operators "$ne" "$inc" "$in" "$set" "$nin" "$push" "$mod" "$pushAll" "$all" "$pop" "$size" "$pull" "$exists" "$pullAll" Monday, 27 September 2010
  • 15. 3 Map reduce for aggregation Monday, 27 September 2010
  • 16. map reduce def self.target_for_report(report) collections = DB['targets'].group(['metric'], { :report_type => report.report_type, :project_name => report.project }, { 'docs' => [] }, "function(doc, prev) { prev.docs.push(doc); }"); end Monday, 27 September 2010
  • 17. 4 Indexes are indexes Monday, 27 September 2010
  • 18. indexes @blogposts.create_index([[ "comments.by" , Mongo::ASCENDING ]]); db.blogposts.ensureIndex( { "comments.by" : 1 } ); @blogposts.create_index([[ :languages , Mongo::ASCENDING ]]); @blogposts.create_index([[ :time , Mongo::DESCENDING ]]); @blogposts.create_index([[ :author , Mongo::ASCENDING, true ]]); @blogposts.create_index( [[ "comments.vote" , 1,], [ "comments.date", -1 ]]); Monday, 27 September 2010
  • 19. 5 GridFS Monday, 27 September 2010
  • 20. api grid = Mongo::Grid.new(DB) my_avatar = File.open('toni.jpg','r') id = grid.put(my_avatar) files collection for metadata chunks collection for data Monday, 27 September 2010
  • 21. 6 Replication Monday, 27 September 2010
  • 22. m/s vs replica set asynchronous replication of data between servers for failover and redundancy only one server (in the set/shard) is active for writes (the primary, or master) at a given time. Monday, 27 September 2010
  • 23. replica sets (1.6+) • Supports 1-7 servers in the cluster • Automatic failover • Automatic recovery Monday, 27 September 2010
  • 24. 7 Auto-shard Monday, 27 September 2010
  • 25. mongo shards Sharding occurs on a per-collection basis Monday, 27 September 2010
  • 26. 8 Pro & Cons Monday, 27 September 2010
  • 27. pro & cons • schema free > no migrations needed • no sql • update existing data • stable • very nice api Monday, 27 September 2010
  • 28. good for • the web • real time • logging • analytics • humans Monday, 27 September 2010
  • 29. 9 Links Monday, 27 September 2010
  • 30. links • http://api.mongodb.org/ruby/1.0.9/ index.html • http://www.mongodb.org/ • http://mongoid.org/ Monday, 27 September 2010
  • 31. 10 Questions Monday, 27 September 2010