KEMBAR78
Document-Oriented Databases: Couchdb Primer | PDF
Document-Oriented Databases
       A CouchDB Primer




Wednesday, March 17, 2010
jsiarto


                            jeff@loudpixel.com



Wednesday, March 17, 2010
SELECT * FROM reviews
       JOIN movies ON movies.id
       = reviews.movie_id WHERE
       movies.title = ‘Gigli’;


                            movies   reviews


Wednesday, March 17, 2010
Name Jeff Siarto
                            Employee Number 0001
                            Titles President, Creative Director, Analyst
                            Websites http://loudpixel.com, http://siarto.com
                            Social Twitter: @jsiarto, Github: jsiarto




             Jeff                        Ryan                       Allie


Wednesday, March 17, 2010
{
              "_id": "1d62f8555188f1267a6fcbe81f9dc54b",
              "_rev": "5-1511a8ac9d5ad5512774545ae390201d",
              "first_name": "Jeff",
              "last_name": "Siarto",
              "titles": [
                  "Partner",
                  "Analyst",
                  "Designer"
              ],
              "online": {
                  "website": "http://siarto.com",
                  "twitter": "@jsiarto",
                  "github": "http://github.com/jsiarto"
              }
       }

Wednesday, March 17, 2010
Data APIs              YAML




                            JSON


       Native Browser              JavaScript
          Support
Wednesday, March 17, 2010
Futon



Wednesday, March 17, 2010
Wednesday, March 17, 2010
REST

       GET http://localhost:5984/loudpixel_employees/1d62f8...


       PUT http://localhost:5984/loudpixel_employees/1d62f8...


       POST http://localhost:5984/loudpixel_employees


       DELETE http://localhost:5984/loudpixel_employees/1d62f8...




Wednesday, March 17, 2010
CouchDB Views




Wednesday, March 17, 2010
Map Function
       function(doc) {
         if (doc.type == "Full-time") {
           doc.titles.map(function(title) {
             emit(title, doc);
           });
         }
       }

       Reduce Function
       function(key, values, combine) {
         return values.length;
       }

Wednesday, March 17, 2010
CouchREST
                            http://github.com/jchris/couchrest
                            CouchREST Rails
                            http://github.com/hpoydar/couchrest-rails




                            CouchDB-Python
                            http://code.google.com/p/couchdb-python/




                            PHPillow
                            http://arbitracker.org/phpillow.html


Wednesday, March 17, 2010
★   Uses BSON instead of JSON
       ★   Dynamic query language
       ★   Interfaces using native drivers (no REST)
       ★   Not as durable as CouchDB in single-server
           deployments




Wednesday, March 17, 2010
Levee
       Monitoring management dashboard that helps you build and
       deliver research reports to clients




            charts




         datasets
                            data points   }         cot-0001



Wednesday, March 17, 2010
Resources

       http://couchdb.apache.org/

       http://peepcode.com/products/couchdb-
       with-rails

       http://books.couchdb.org/relax/

       http://www.mongodb.org/display/DOCS/
       MongoDB,+CouchDB,+MySQL+Compare+Grid




Wednesday, March 17, 2010

Document-Oriented Databases: Couchdb Primer

  • 1.
    Document-Oriented Databases A CouchDB Primer Wednesday, March 17, 2010
  • 2.
    jsiarto jeff@loudpixel.com Wednesday, March 17, 2010
  • 3.
    SELECT * FROMreviews JOIN movies ON movies.id = reviews.movie_id WHERE movies.title = ‘Gigli’; movies reviews Wednesday, March 17, 2010
  • 4.
    Name Jeff Siarto Employee Number 0001 Titles President, Creative Director, Analyst Websites http://loudpixel.com, http://siarto.com Social Twitter: @jsiarto, Github: jsiarto Jeff Ryan Allie Wednesday, March 17, 2010
  • 5.
    { "_id": "1d62f8555188f1267a6fcbe81f9dc54b", "_rev": "5-1511a8ac9d5ad5512774545ae390201d", "first_name": "Jeff", "last_name": "Siarto", "titles": [ "Partner", "Analyst", "Designer" ], "online": { "website": "http://siarto.com", "twitter": "@jsiarto", "github": "http://github.com/jsiarto" } } Wednesday, March 17, 2010
  • 6.
    Data APIs YAML JSON Native Browser JavaScript Support Wednesday, March 17, 2010
  • 7.
  • 8.
  • 9.
    REST GET http://localhost:5984/loudpixel_employees/1d62f8... PUT http://localhost:5984/loudpixel_employees/1d62f8... POST http://localhost:5984/loudpixel_employees DELETE http://localhost:5984/loudpixel_employees/1d62f8... Wednesday, March 17, 2010
  • 10.
  • 11.
    Map Function function(doc) { if (doc.type == "Full-time") { doc.titles.map(function(title) { emit(title, doc); }); } } Reduce Function function(key, values, combine) { return values.length; } Wednesday, March 17, 2010
  • 12.
    CouchREST http://github.com/jchris/couchrest CouchREST Rails http://github.com/hpoydar/couchrest-rails CouchDB-Python http://code.google.com/p/couchdb-python/ PHPillow http://arbitracker.org/phpillow.html Wednesday, March 17, 2010
  • 13.
    Uses BSON instead of JSON ★ Dynamic query language ★ Interfaces using native drivers (no REST) ★ Not as durable as CouchDB in single-server deployments Wednesday, March 17, 2010
  • 14.
    Levee Monitoring management dashboard that helps you build and deliver research reports to clients charts datasets data points } cot-0001 Wednesday, March 17, 2010
  • 15.
    Resources http://couchdb.apache.org/ http://peepcode.com/products/couchdb- with-rails http://books.couchdb.org/relax/ http://www.mongodb.org/display/DOCS/ MongoDB,+CouchDB,+MySQL+Compare+Grid Wednesday, March 17, 2010