SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
SimplyStored & RockingChair
                Ruby on CouchDB




                Jonathan Weiss, 04.03.2010
                Peritor GmbH


Thursday, March 4, 2010
Peritor




               Cloud-Management und -Deployment made easy
                           http://scalarium.com


                                                            2

Thursday, March 4, 2010
Database Requirements


    High availability
    Easy replication and copy
    Clustering




                                3

Thursday, March 4, 2010
CouchDB
                               relax
                                       4

Thursday, March 4, 2010
Die Lösung


    Built for the Web
    Scales
    Performant
    Replication built-in
    Flexible schema




                           5

Thursday, March 4, 2010
CouchDB


              {
                  "_id": "BCCD12CBB",
                  "_rev": "1-AB764C",
                  "type": "person",
                  "name": "Darth Vader",
                  "age": 63,
                  "headware": ["Helmet", "Sombrero"],
                  "dark_side": true
              }

                                                        6

Thursday, March 4, 2010
CouchDB


              {
                  "_id": "BCCD12CBB",
                  "_rev": "1-AB764C",
                  "type": "person",
                  "name": "Darth Vader",
                  "age": 63,
                  "headware": ["Helmet", "Sombrero"],
                  "dark_side": true
              }

                                                        7

Thursday, March 4, 2010
CouchDB


              {
                  "_id": "BCCD12CBB",
                  "_rev": "1-AB764C",
                  "type": "person",
                  "name": "Darth Vader",
                  "age": 63,
                  "headware": ["Helmet", "Sombrero"],
                  "dark_side": true
              }

                                                        8

Thursday, March 4, 2010
CouchDB - CRUD
    Create and update:
    PUT /starwars/BCCD12CBB


    Read:
    GET /starwars/BCCD12CBB


    Delete:
    DELETE /starwars/BCCD12CBB

                                 9

Thursday, March 4, 2010
CouchDB




    How do I query my data?




                              10

Thursday, March 4, 2010
CouchDB




                          Views!


                                   11

Thursday, March 4, 2010
CouchDB


          function(doc) {
            if (doc.headware) {
              for (var hat in doc.headware) {
                emit(hat, 1);
              }
            }
          }

                                                12

Thursday, March 4, 2010
CouchDB



                  function(keys, values, rereduce) {
                    return sum(values);
                  }




                                                       13

Thursday, March 4, 2010
CouchDB



                  function(keys, values, rereduce) {
                    return sum(values);
                  }




                                                       14

Thursday, March 4, 2010
Queries

                          SQL               CouchDB JavaScript

                SELECT * FROM       function(doc) {

                                        if (doc['ruby_class'] == 'User' &&
                `users` WHERE               doc['status'] == 1) {

                `users`.id = 5              emit([doc.project_id,
                                                  doc.created_at], null);
                AND `status` = 1;       }

                                    }




                                                                             15

Thursday, March 4, 2010
Queries

                          ActiveRecord              SimplyStored

         class Project < ActiveRecord::Base   class Project

           has_many :users                     include SimplyStored::Couch

         end                                   has_many :users

                                              end



         Project.first.users                   Project.first.users




                                                                             16

Thursday, March 4, 2010
SimplyStored

                                     SimplyStored

                                Models

                                Associations

                                Validations

                                Callbacks

                                Dynamic finder

                                S3 attachments

                                Paranoid delete



                      http://github.com/peritor/simply_stored
                                                                17

Thursday, March 4, 2010
SimplyStored


    Standing on the shoulders of giants:
        - CouchPotato
        - CouchRest
        - RestClient
        - HTTP
        - CouchDB

                      http://github.com/peritor/simply_stored

Thursday, March 4, 2010
RockingChair


    In-memory CouchDB
        - Just a big Hash
        - Speeds up your tests
        - Tests can run in parallel
        - Nice for debugging


                      http://github.com/jweiss/rocking_chair


Thursday, March 4, 2010
Now show me some Code!




Thursday, March 4, 2010
Peritor GmbH
                Blücherstr. 22, Hof III Aufgang 6
                10961 Berlin
                Tel.: +49 (0)30 69 20 09 84 0
                Fax: +49 (0)30 69 20 09 84 9
                Internet: www.peritor.com
                E-Mail: info@peritor.com



                © Peritor GmbH - Alle Rechte Vorbehalten

Thursday, March 4, 2010

Weitere ähnliche Inhalte

Was ist angesagt?

Distributed Social Networking
Distributed Social NetworkingDistributed Social Networking
Distributed Social Networking
Bastian Hofmann
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
Chris Anderson
 
Robb broome rubyconf x presentation for publication
Robb broome rubyconf x presentation for publicationRobb broome rubyconf x presentation for publication
Robb broome rubyconf x presentation for publication
Robb Broome
 

Was ist angesagt? (13)

"Solr Update" at code4lib '13 - Chicago
"Solr Update" at code4lib '13 - Chicago"Solr Update" at code4lib '13 - Chicago
"Solr Update" at code4lib '13 - Chicago
 
Mongo db
Mongo dbMongo db
Mongo db
 
Thinking in documents
Thinking in documentsThinking in documents
Thinking in documents
 
Distributed Social Networking
Distributed Social NetworkingDistributed Social Networking
Distributed Social Networking
 
Not Only Drupal
Not Only DrupalNot Only Drupal
Not Only Drupal
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
 
CouchDB in The Room
CouchDB in The RoomCouchDB in The Room
CouchDB in The Room
 
PHP - Introduction to PHP MySQL Joins and SQL Functions
PHP -  Introduction to PHP MySQL Joins and SQL FunctionsPHP -  Introduction to PHP MySQL Joins and SQL Functions
PHP - Introduction to PHP MySQL Joins and SQL Functions
 
ข่าวIt
ข่าวItข่าวIt
ข่าวIt
 
Tthornton code4lib
Tthornton code4libTthornton code4lib
Tthornton code4lib
 
Prototype 패턴 (심만섭)
Prototype 패턴 (심만섭) Prototype 패턴 (심만섭)
Prototype 패턴 (심만섭)
 
Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands
 
Robb broome rubyconf x presentation for publication
Robb broome rubyconf x presentation for publicationRobb broome rubyconf x presentation for publication
Robb broome rubyconf x presentation for publication
 

Ähnlich wie Ruby on CouchDB - SimplyStored and RockingChair

Document-Oriented Databases: Couchdb Primer
Document-Oriented Databases: Couchdb PrimerDocument-Oriented Databases: Couchdb Primer
Document-Oriented Databases: Couchdb Primer
jsiarto
 
Terrastore - A document database for developers
Terrastore - A document database for developersTerrastore - A document database for developers
Terrastore - A document database for developers
Sergio Bossa
 
Couchdbkit djangocong-20100425
Couchdbkit djangocong-20100425Couchdbkit djangocong-20100425
Couchdbkit djangocong-20100425
guest4f2eea
 
IPTC News in JSON Spring 2013
IPTC News in JSON Spring 2013IPTC News in JSON Spring 2013
IPTC News in JSON Spring 2013
Stuart Myles
 

Ähnlich wie Ruby on CouchDB - SimplyStored and RockingChair (20)

Node.js - A Quick Tour II
Node.js - A Quick Tour IINode.js - A Quick Tour II
Node.js - A Quick Tour II
 
Document-Oriented Databases: Couchdb Primer
Document-Oriented Databases: Couchdb PrimerDocument-Oriented Databases: Couchdb Primer
Document-Oriented Databases: Couchdb Primer
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling
 
Terrastore - A document database for developers
Terrastore - A document database for developersTerrastore - A document database for developers
Terrastore - A document database for developers
 
Couchdbkit & Dango
Couchdbkit & DangoCouchdbkit & Dango
Couchdbkit & Dango
 
Couchdbkit djangocong-20100425
Couchdbkit djangocong-20100425Couchdbkit djangocong-20100425
Couchdbkit djangocong-20100425
 
Persisting dynamic data with mongodb and mongomapper
Persisting dynamic data with mongodb and mongomapperPersisting dynamic data with mongodb and mongomapper
Persisting dynamic data with mongodb and mongomapper
 
noSQL @ QCon SP
noSQL @ QCon SPnoSQL @ QCon SP
noSQL @ QCon SP
 
JClouds at San Francisco Java User Group
JClouds at San Francisco Java User GroupJClouds at San Francisco Java User Group
JClouds at San Francisco Java User Group
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4
 
NoSQL - Post-Relational Databases - BarCamp Ruhr3
NoSQL - Post-Relational Databases - BarCamp Ruhr3NoSQL - Post-Relational Databases - BarCamp Ruhr3
NoSQL - Post-Relational Databases - BarCamp Ruhr3
 
Getting Started with Dojo Toolkit
Getting Started with Dojo ToolkitGetting Started with Dojo Toolkit
Getting Started with Dojo Toolkit
 
Glrb2010 auvi
Glrb2010 auviGlrb2010 auvi
Glrb2010 auvi
 
Meet Couch DB
Meet Couch DBMeet Couch DB
Meet Couch DB
 
IPTC News in JSON Spring 2013
IPTC News in JSON Spring 2013IPTC News in JSON Spring 2013
IPTC News in JSON Spring 2013
 
Java 5 PSM for DDS: Initial Submission (out of date)
Java 5 PSM for DDS: Initial Submission (out of date)Java 5 PSM for DDS: Initial Submission (out of date)
Java 5 PSM for DDS: Initial Submission (out of date)
 
Node.js and Ruby
Node.js and RubyNode.js and Ruby
Node.js and Ruby
 
Latinoware
LatinowareLatinoware
Latinoware
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring Data
 

Mehr von Jonathan Weiss

DevOpsDays Amsterdam - Observations in the cloud
DevOpsDays Amsterdam - Observations in the cloudDevOpsDays Amsterdam - Observations in the cloud
DevOpsDays Amsterdam - Observations in the cloud
Jonathan Weiss
 
CouchDB on Rails - FrozenRails 2010
CouchDB on Rails - FrozenRails 2010CouchDB on Rails - FrozenRails 2010
CouchDB on Rails - FrozenRails 2010
Jonathan Weiss
 

Mehr von Jonathan Weiss (20)

Docker on AWS OpsWorks
Docker on AWS OpsWorksDocker on AWS OpsWorks
Docker on AWS OpsWorks
 
ChefConf 2014 - AWS OpsWorks Under The Hood
ChefConf 2014 - AWS OpsWorks Under The HoodChefConf 2014 - AWS OpsWorks Under The Hood
ChefConf 2014 - AWS OpsWorks Under The Hood
 
AWS OpsWorks & Chef at the Hamburg Chef User Group 2014
AWS OpsWorks & Chef at the Hamburg Chef User Group 2014AWS OpsWorks & Chef at the Hamburg Chef User Group 2014
AWS OpsWorks & Chef at the Hamburg Chef User Group 2014
 
DevOpsDays Amsterdam - Observations in the cloud
DevOpsDays Amsterdam - Observations in the cloudDevOpsDays Amsterdam - Observations in the cloud
DevOpsDays Amsterdam - Observations in the cloud
 
Amazon SWF and Gordon
Amazon SWF and GordonAmazon SWF and Gordon
Amazon SWF and Gordon
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.js
 
Scalarium and CouchDB
Scalarium and CouchDBScalarium and CouchDB
Scalarium and CouchDB
 
Build your own clouds with Chef and MCollective
Build your own clouds with Chef and MCollectiveBuild your own clouds with Chef and MCollective
Build your own clouds with Chef and MCollective
 
NoSQL - Motivation and Overview
NoSQL - Motivation and OverviewNoSQL - Motivation and Overview
NoSQL - Motivation and Overview
 
NoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDBNoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDB
 
Running on Amazon EC2
Running on Amazon EC2Running on Amazon EC2
Running on Amazon EC2
 
Amazon EC2 in der Praxis
Amazon EC2 in der PraxisAmazon EC2 in der Praxis
Amazon EC2 in der Praxis
 
Infrastructure Automation with Chef
Infrastructure Automation with ChefInfrastructure Automation with Chef
Infrastructure Automation with Chef
 
Rails in the Cloud
Rails in the CloudRails in the Cloud
Rails in the Cloud
 
EventMachine
EventMachineEventMachine
EventMachine
 
CouchDB on Rails
CouchDB on RailsCouchDB on Rails
CouchDB on Rails
 
Rails in the Cloud - Experiences from running on EC2
Rails in the Cloud - Experiences from running on EC2Rails in the Cloud - Experiences from running on EC2
Rails in the Cloud - Experiences from running on EC2
 
CouchDB on Rails - RailsWayCon 2010
CouchDB on Rails - RailsWayCon 2010CouchDB on Rails - RailsWayCon 2010
CouchDB on Rails - RailsWayCon 2010
 
CouchDB on Rails - FrozenRails 2010
CouchDB on Rails - FrozenRails 2010CouchDB on Rails - FrozenRails 2010
CouchDB on Rails - FrozenRails 2010
 
No SQL - BarCamp Nürnberg 2010
No SQL - BarCamp Nürnberg 2010No SQL - BarCamp Nürnberg 2010
No SQL - BarCamp Nürnberg 2010
 

Kürzlich hochgeladen

+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
+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...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
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...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Ruby on CouchDB - SimplyStored and RockingChair

  • 1. SimplyStored & RockingChair Ruby on CouchDB Jonathan Weiss, 04.03.2010 Peritor GmbH Thursday, March 4, 2010
  • 2. Peritor Cloud-Management und -Deployment made easy http://scalarium.com 2 Thursday, March 4, 2010
  • 3. Database Requirements High availability Easy replication and copy Clustering 3 Thursday, March 4, 2010
  • 4. CouchDB relax 4 Thursday, March 4, 2010
  • 5. Die Lösung Built for the Web Scales Performant Replication built-in Flexible schema 5 Thursday, March 4, 2010
  • 6. CouchDB { "_id": "BCCD12CBB", "_rev": "1-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } 6 Thursday, March 4, 2010
  • 7. CouchDB { "_id": "BCCD12CBB", "_rev": "1-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } 7 Thursday, March 4, 2010
  • 8. CouchDB { "_id": "BCCD12CBB", "_rev": "1-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } 8 Thursday, March 4, 2010
  • 9. CouchDB - CRUD Create and update: PUT /starwars/BCCD12CBB Read: GET /starwars/BCCD12CBB Delete: DELETE /starwars/BCCD12CBB 9 Thursday, March 4, 2010
  • 10. CouchDB How do I query my data? 10 Thursday, March 4, 2010
  • 11. CouchDB Views! 11 Thursday, March 4, 2010
  • 12. CouchDB function(doc) { if (doc.headware) { for (var hat in doc.headware) { emit(hat, 1); } } } 12 Thursday, March 4, 2010
  • 13. CouchDB function(keys, values, rereduce) { return sum(values); } 13 Thursday, March 4, 2010
  • 14. CouchDB function(keys, values, rereduce) { return sum(values); } 14 Thursday, March 4, 2010
  • 15. Queries SQL CouchDB JavaScript SELECT * FROM function(doc) { if (doc['ruby_class'] == 'User' && `users` WHERE doc['status'] == 1) { `users`.id = 5 emit([doc.project_id, doc.created_at], null); AND `status` = 1; } } 15 Thursday, March 4, 2010
  • 16. Queries ActiveRecord SimplyStored class Project < ActiveRecord::Base class Project has_many :users include SimplyStored::Couch end has_many :users end Project.first.users Project.first.users 16 Thursday, March 4, 2010
  • 17. SimplyStored SimplyStored Models Associations Validations Callbacks Dynamic finder S3 attachments Paranoid delete http://github.com/peritor/simply_stored 17 Thursday, March 4, 2010
  • 18. SimplyStored Standing on the shoulders of giants: - CouchPotato - CouchRest - RestClient - HTTP - CouchDB http://github.com/peritor/simply_stored Thursday, March 4, 2010
  • 19. RockingChair In-memory CouchDB - Just a big Hash - Speeds up your tests - Tests can run in parallel - Nice for debugging http://github.com/jweiss/rocking_chair Thursday, March 4, 2010
  • 20. Now show me some Code! Thursday, March 4, 2010
  • 21. Peritor GmbH Blücherstr. 22, Hof III Aufgang 6 10961 Berlin Tel.: +49 (0)30 69 20 09 84 0 Fax: +49 (0)30 69 20 09 84 9 Internet: www.peritor.com E-Mail: info@peritor.com © Peritor GmbH - Alle Rechte Vorbehalten Thursday, March 4, 2010