SlideShare a Scribd company logo
1 of 402
Learning CouchDB
A Non-Relational Alternative to Data Persistence
      for Modern Software Applications
Is CouchDB a good choice
for your application?
Problem:
The Object-Relational
Impedance Mismatch  [1]
How to persist data in an object-oriented software application?




                                     1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch
                                     2. http://martinfowler.com/eaaCatalog/repository.html
                                     3. http://c2.com/cgi/wiki?ObjectRelationalMapping
Problem:
The Object-Relational
Impedance Mismatch  [1]
How to persist data in an object-oriented software application?




                                     1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch
                                     2. http://martinfowler.com/eaaCatalog/repository.html
                                     3. http://c2.com/cgi/wiki?ObjectRelationalMapping
Problem:
The Object-Relational
Impedance Mismatch  [1]
How to persist data in an object-oriented software application?



  s eparate domain
 a nd data mapping
       layers[2]




                                     1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch
                                     2. http://martinfowler.com/eaaCatalog/repository.html
                                     3. http://c2.com/cgi/wiki?ObjectRelationalMapping
Problem:
The Object-Relational
Impedance Mismatch  [1]
How to persist data in an object-oriented software application?



  s eparate domain
 a nd data mapping
       layers[2]
                        object-relational
                        mapping (ORM)[3]




                                     1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch
                                     2. http://martinfowler.com/eaaCatalog/repository.html
                                     3. http://c2.com/cgi/wiki?ObjectRelationalMapping
Problem:
The Object-Relational
Impedance Mismatch  [1]
How to persist data in an object-oriented software application?



  s eparate domain
 a nd data mapping                                          non-relational
       layers[2]                                              database
                        object-relational
                        mapping (ORM)[3]




                                     1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch
                                     2. http://martinfowler.com/eaaCatalog/repository.html
                                     3. http://c2.com/cgi/wiki?ObjectRelationalMapping
Problem:
The Object-Relational
Impedance Mismatch  [1]
How to persist data in an object-oriented software application?



  s eparate domain
 a nd data mapping                                          non-relational
       layers[2]                                              database
                        object-relational
                        mapping (ORM)[3]




                                     1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch
                                     2. http://martinfowler.com/eaaCatalog/repository.html
                                     3. http://c2.com/cgi/wiki?ObjectRelationalMapping
Problem:
Semi-Structured Data
How to persist data with exible schemas?
Problem:
Semi-Structured Data
How to persist data with exible schemas?
Problem:
Semi-Structured Data
How to persist data with exible schemas?




     leave
 non- applicable ll
column values nu
Problem:
Semi-Structured Data
How to persist data with exible schemas?



                             use the
                        entity-attribute-
                          value (EAV )
     leave               anti-pattern[1]
 non- applicable ll
column values nu




                                            1. http://pragprog.com/book/bksqla/sql-antipatterns
Problem:
Semi-Structured Data
How to persist data with exible schemas?



                             use the
                        entity-attribute-
                          value (EAV )
     leave               anti-pattern[1]                      use a
 non- applicable ll                                       schema-less
column values nu                                         database with a
                                                         self-describing
                                                            structure




                                            1. http://pragprog.com/book/bksqla/sql-antipatterns
Problem:
Semi-Structured Data
How to persist data with exible schemas?



                             use the
                        entity-attribute-
                          value (EAV )
     leave               anti-pattern[1]                      use a
 non- applicable ll                                       schema-less
column values nu                                         database with a
                                                         self-describing
                                                            structure




                                            1. http://pragprog.com/book/bksqla/sql-antipatterns
Problem:
Persisting Graph
Relationships
How to persist graphs, trees and hierarchical data?
Problem:
Persisting Graph
Relationships
How to persist graphs, trees and hierarchical data?
Problem:
Persisting Graph
Relationships
How to persist graphs, trees and hierarchical data?




 model hierarchical
   data in SQL[1]




                      1. http://www.percona.com/webinars/2011-02-28-models-for-hierarchical-data-in-sql-and-php/
                      2. http://www.graph-database.org/
Problem:
Persisting Graph
Relationships
How to persist graphs, trees and hierarchical data?




 model hierarchical
   data in SQL[1]             graph database[2]




                      1. http://www.percona.com/webinars/2011-02-28-models-for-hierarchical-data-in-sql-and-php/
                      2. http://www.graph-database.org/
Problem:
Persisting Graph
Relationships
How to persist graphs, trees and hierarchical data?




 model hierarchical                                                           document
                                                                          oriented d    -
   data in SQL[1]             graph database[2]                                      ataba           se




                      1. http://www.percona.com/webinars/2011-02-28-models-for-hierarchical-data-in-sql-and-php/
                      2. http://www.graph-database.org/
Problem:
Persisting Graph
Relationships
How to persist graphs, trees and hierarchical data?




 model hierarchical                                                           document
                                                                          oriented d    -
   data in SQL[1]             graph database[2]                                      ataba           se




                      1. http://www.percona.com/webinars/2011-02-28-models-for-hierarchical-data-in-sql-and-php/
                      2. http://www.graph-database.org/
Problem:
Achieving High Concurrency
How to give up consistency in exchange for high availability? [1]




                                   1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
Problem:
Achieving High Concurrency
How to give up consistency in exchange for high availability? [1]




                                   1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
Problem:
Achieving High Concurrency
How to give up consistency in exchange for high availability? [1]



     reduce
   transaction
      scope




                                   1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
Problem:
Achieving High Concurrency
How to give up consistency in exchange for high availability? [1]



     reduce
   transaction                  database
      scope                    replication




                                   1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
Problem:
Achieving High Concurrency
How to give up consistency in exchange for high availability? [1]



     reduce
   transaction                  database
      scope                    replication




            denormalization


                                   1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
Problem:
Achieving High Concurrency
How to give up consistency in exchange for high availability? [1]



     reduce
   transaction                  database
      scope                    replication




                                                                 multi-version
                                                                 concurrency
                                                                control (MVCC)
            denormalization


                                   1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
Problem:
Achieving High Concurrency
How to give up consistency in exchange for high availability? [1]



     reduce
   transaction                  database
      scope                    replication




                                                                 multi-version
                                                                 concurrency
                                                                control (MVCC)
            denormalization


                                   1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
Problem:
Building in Fault-Tolerance
How to make a fault-tolerant system?
Problem:
Building in Fault-Tolerance
How to make a fault-tolerant system?
Problem:
Building in Fault-Tolerance
How to make a fault-tolerant system?




     promote
  slave database
 to master on fault
Problem:
Building in Fault-Tolerance
How to make a fault-tolerant system?




                          isolate faults
     promote
  slave database
 to master on fault
Problem:
Building in Fault-Tolerance
How to make a fault-tolerant system?




                          isolate faults
     promote
  slave database                           multi-master
 to master on fault                        replication
Problem:
Building in Fault-Tolerance
How to make a fault-tolerant system?




                          isolate faults
     promote
  slave database                           multi-master
 to master on fault                        replication
Problem:
Flexible Indexing
How to index data other than direct column values?
Problem:
Flexible Indexing
How to index data other than direct column values?
Problem:
Flexible Indexing
How to index data other than direct column values?




     d enormalize
Problem:
Flexible Indexing
How to index data other than direct column values?




     d enormalize


                         user-de ned t
                                       ypes
Problem:
Flexible Indexing
How to index data other than direct column values?




     d enormalize
                                                     Map/Reduce


                         user-de ned t
                                       ypes
Problem:
Flexible Indexing
How to index data other than direct column values?




     d enormalize
                                                     Map/Reduce


                         user-de ned t
                                       ypes
Lesson
About CouchDB
Schema-Less
• stores self-contained JSON documents
• related entities can be stored in a single document
• only store elds that are needed in each document
Futon Web Administration
•   built-in web administration console
•   default location is: http://localhost:5984/_utils/
•   create, read, update and delete databases and documents
•   query databases
•   con gure CouchDB
•   replicate between databases
•   view task status
•   run test suite
•   set up server admins
•   con gure database security
•   run compaction and cleanup maintenance tasks
CouchDB Views
• queries are run against indexed views
• views are generated through incremental Map functions
• aggregate results can be retrieved through Reduce functions
HTTP API
• every language and platform has an HTTP client
• uses existing semantics (e.g. 201 Created, 202 Accepted)
• distributed, scalable and cacheable
CouchDB and PHP
• can just use an HTTP client
• several client libraries speci c to CouchDB are available
Flexible Querying Options
•   all rows in a given view
•   row(s) matching a speci ed key
•   rows by start and end keys
•   exact grouping
•   group by levels
•   limit and skip parameters
•   output in descending order
•   include original documents in result set
Lesson
Installation
CouchDB or Couchbase
CouchDB:
  • project of the Apache Software Foundation
  • available through package managers
Couchbase:
  • superset of CouchDB
  • includes geospatial indexing
  • available as Couchbase Mobile for iOS and Android
  • commercial support options available
CouchDB Installation
• Mac OS X
  • Homebrew
  • MacPorts
• Windows
  • binary installer[1]
• Ubuntu
  • Aptitude
• Red Hat
  • Yum


                          1. http://wiki.apache.org/couchdb/Windows_binary_installer
Couchbase Single                        Server[1]

Available for:
  • Mac OS X
  • Windows
  • Ubuntu
  • Red Hat




                 1. http://www.couchbase.com/products-and-services/couchbase-single-server
Lab
Install CouchDB or Couchbase
Installation and Startup                        :03

1. Install CouchDB
   OR
   Install Couchbase Single Server
2. If CouchDB, then at the command-line:
  $ sudo couchdb

   Apache CouchDB has started. Time to relax.
3. Optionally, test CouchDB:
  $ curl 'http://localhost:5984/'

  {"couchdb":"Welcome","version":"1.1.0"}
Lesson
JSON Documents
Why JSON?
• human-readable and simple data interchange format
• data structures from many programming languages can be
    easily converted to and from JSON
•   lightweight—doesn’t add too much to bandwidth overhead
JSON Data Types
• String
• Number
• Boolean (false or true)
• JSON Array (e.g. ["a", "b", "c"])
• JSON Object: collection of name/value pairs where the name
    is a String and the value is any valid JSON data type
•   JSON NULL (null)
Example JSON Object
{
    "_id":"978-0-596-15589-6",
    "title":"CouchDB: The De nitive Guide",
    "subtitle":"Time to Relax",
    "authors":[
       "J. Chris Anderson",
       "Jan Lehnardt",
       "Noah Slater"
    ],
    "publisher":"O'Reilly Media",
    "released":"2010-01-19",
    "pages":272
}
Lab
Futon
Access Futon                                            :01

1. Visit Futon in your web browser:
   http://localhost:5984/_utils/
2. Note the existing _replicator and _users databases
3. Note the Tools navigation section
4. Note the following message:
   “Welcome to Admin Party!”
Access Futon
Create a Database                           :01

1. Click Create Database …
2. Enter “books” in the Database Name eld
3. Click the Create button
Create a Database
Create a Document                                             :05

1. Click New Document
2. Enter “978-0-596-15589-6” as the value for the _id eld, and
   then click apply
3. Using the Add Field button, add a “title” eld with a value of
   “CouchDB: The De nitive Guide”
4. Add a “subtitle” eld with a value of “Time to Relax”
5. Add an “authors” eld with a value of:
   ["J. Chris Anderson", "Jan Lehnardt", "Noah Slater"]
6. Add a “publisher” eld with a value of “O'Reilly Media”
7. Add a “released” eld with a value of “2010-01-19”
8. Add a “pages” eld with a value of “272”
9. Click Save Document
Create a Document
Lesson
Map Functions
Map Functions
•   used to transform documents into key/value pairs
•   user-de ned, typically written in JavaScript
•   every document is incrementally passed through this function
•   function is passed a JSON object representing a document
•   function calls an emit function zero, one or more times
•   emit function accepts two arguments:
    • a key
    • a value to be associated with the key
•   an id eld is implicitly emitted as well
Temporary Views
• contains a Map function and an optional Reduce function
• useful in development
• very slow on large data sets
Lab
One-To-One Mapping
Map Book Titles                                           :03

1. Click on the books database in the breadcrumb navigation
2. Select Temporary view… from the View select menu
3. Enter the following in the View Code text area:
   function(doc) {
     if (doc.title) {
        emit(doc.title);
     }
   }
4. Click Run
Map Book Titles
Map functions must be deterministic.
Given the same input, a Map function
must always return the same output.
Add a Second Document                                         :05

1. Click New Document
2. Enter “978-0-596-52926-0” as the value for the _id eld, and
   then click apply
3. Add a “title” eld with a value of “RESTful Web Services”
4. Add a “subtitle” eld with a value of “Web services for the real
   world”
5. Add an “authors” eld with a value of:
   ["Leonard Richardson", "Sam Ruby"]
6. Add a “publisher” eld with a value of “O'Reilly Media”
7. Add a “released” eld with a value of “2007-05-08”
8. Add a “pages” eld with a value of “448”
9. Click Save Document
Add a Second Document
Map Book Titles                                             :01

1. Click on the books database in the breadcrumb navigation
2. If not already selected, select Temporary view… from the View
   select menu
3. If not already entered, enter the following in the View Code
   text area:
   function(doc) {
     if (doc.title) {
        emit(doc.title);
     }
   }
4. Click Run
Map Book Titles
Lab
One-To-Many Mapping
Add a formats Field                                       :03

1. Navigate to the books database, if not already there
2. Select All documents from the View select menu
3. Click the rst document, 978-0-596-15589-6
4. Add a “formats” eld with a value of:
   ["Print", "Ebook", "Safari Books Online"]
5. Click Save Document
6. Navigate back to the books database
7. Repeat steps 3 through 6 for the second document,
   978-0-596-52926-0
When updating documents, you may
have noticed the _rev eld, an artifact
of CouchDB’s Multi-Version Concurrency
Control (MVCC).
Add a Third Document                                           :05

1. Click New Document
2. Enter “978-1-565-92580-9” as the value for the _id eld, and then
   click apply
3. Add a “title” eld with a value of “DocBook: The De nitive Guide”
4. Add an “authors” eld with a value of:
   ["Norman Walsh", "Leonard Muellner"]
5. Add a “publisher” eld with a value of “O'Reilly Media”
6. Add a “formats” eld with a value of:
   ["Print"]
7. Add a “released” eld with a value of “1999-10-28”
8. Add a “pages” eld with a value of “648”
9. Click Save Document
Add a Third Document
Map Book Formats                                      :03

1. Navigate to the books database
2. Select Temporary view… from the View select menu
3. Enter the following in the View Code text area:
   function(doc) {
     if (doc.formats) {
        for (var i in doc.formats) {
          emit(doc.formats[i]);
        }
     }
   }
4. Click Run
Map Book Formats
Map Book Authors                                      :02

1. Navigate to the books database
2. Select Temporary view… from the View select menu
3. Enter the following in the View Code text area:
   function(doc) {
     if (doc.authors) {
        for (var i in doc.authors) {
          emit(doc.authors[i]);
        }
     }
   }
4. Click Run
Map Book Authors
Lesson
Reduce Functions
Reduce Functions
•   optional, run against data set produced by a Map function
•   typically used to reduce a set of values to a single, scalar value
•   can reference built-in Reduce functions
•   custom Reduce functions can be written in JavaScript
•   set of already reduced data may be rereduced
•   function is passed three arguments:
    • keys: array of mapped keys and associated document
      identi ers in the form of [key, id]
    • values: array of mapped values
    • rereduce: boolean value indicating whether or not the
      reduce function is being called recursively on its own
      output (in which case, keys will be null)
Built-In Reduce Functions
• written in CouchDB’s native Erlang
• faster than user-de ned JavaScript functions
• includes:
   • _count
   • _sum
   • _stats
If you think that you need to write
your own custom Reduce function,
you’re probably doing it wrong.
Grouping
•   values can be reduced by group
•   grouping is controlled by a query, not by the Reduce function
•   grouping is done by key
•   key levels, or parts of a key, can also be grouped on
Lab
Built-In Reduce Functions
The built-in _count function can reduce
arbitrary values, including null values.
Count: No Grouping                                         :03

1. Select Temporary view… from the View select menu
2. Enter the following in the View Code text area:
   function(doc) {
     if (doc.formats) {
        for (var i in doc.formats) {
          emit(doc.formats[i]);
        }
     }
   }
3. Enter the following in the Reduce Function text area:
   _count
4. Click Run
5. Check the Reduce checkbox
6. Select none from the Grouping select menu
Count: No Grouping
Count: Exact Grouping                           :01

1. Select exact from the Grouping select menu
Count: Exact Grouping
The _sum and _stats functions
will only reduce sets of numbers.
Sum: Exact Grouping                                         :02

1. Update the View Code text area with the following:
   function(doc) {
     if (doc.formats) {
        for (var i in doc.formats) {
          emit(doc.formats[i], doc.pages);
        }
     }
   }
2. Enter the following in the Reduce Function text area:
   _sum
3. Click Run
4. The Reduce checkbox should be checked
5. exact should be selected from the Grouping select menu
Sum: Exact Grouping
Stats: Exact Grouping                                       :01

1. Enter the following in the Reduce Function text area:
   _stats
2. Click Run
3. The Reduce checkbox should be checked
4. exact should be selected from the Grouping select menu
Stats: Exact Grouping
Map/Reduce gives you tremendous
 exibility, but has its limitations:
no ad-hoc queries*
index is one dimensional
only key or range queries are allowed†




                         *Temporary  views are only useful in development, not in production.
                         †Multiple key queries are allowed, but result in multiple hits on the index.
Lesson
Design Documents
Non-Temporary Views
•   multiple views can be de ned within a design document
•   a view contains a Map and an optional Reduce function
•   a view is recomputed when its design document is updated
•   views are incrementally re-indexed after documents are
    created, updated or deleted*




                                   *Technically,   views are incrementally re-indexed when queried.
Contents of a
Design Document
• view de nitions
   • Map functions
   • Reduce functions
• show functions
• list functions
• document update handlers
• document update validation functions
• rewrite de nitions
• arbitrary elds
• arbitrary attachments
Lab
Design Documents
Titles View                                                :05

1. Update the View Code text area with the following:
   function(doc) {
     if (doc.title) {
        emit(doc.title, doc.pages);
     }
   }
2. Enter the following in the Reduce Function text area:
   _stats
3. Click Save As…
4. Enter “default” as the Design Document name
5. Enter “titles” as the View Name
6. Click Save
Titles View
Query Titles View                                                :01

1.   Select titles from the View select menu, if not already selected
2.   Click arrow next to View Code, if you’d like
3.   Check the Reduce checkbox, if not already checked
4.   Select none from the Grouping select menu
Query Titles View
Formats View                                               :05

1. Update the View Code text area with the following:
   function(doc) {
     if (doc.formats) {
        for (var i in doc.formats) {
          emit(doc.formats[i], doc.pages);
        }
     }
   }
2. Enter the following in the Reduce Function text area:
   _stats
3. Click Save As…
4. Enter “default” as the Design Document name
5. Enter “formats” as the View Name
6. Click Save
Formats View
Query Formats View                                     :01

1. Select formats from the View select menu, if not
   already selected
2. Click the arrow next to View Code, if you’d like
3. Check the Reduce checkbox, if not already checked
4. Select none from the Grouping select menu
Query Formats View
Authors View                                               :05

1. Update the View Code text area with the following:
   function(doc) {
     if (doc.authors) {
        for (var i in doc.authors) {
          emit(doc.authors[i], doc.pages);
        }
     }
   }
2. Enter the following in the Reduce Function text area:
   _stats
3. Click Save As…
4. Enter “default” as the Design Document name
5. Enter “authors” as the View Name
6. Click Save
Authors View
Query Authors View                                            :01

1. Select authors from the View select menu, if not already
   selected
2. Click arrow next to View Code, if you’d like
3. Check the Reduce checkbox, if not already checked
4. Select none from the Grouping select menu
Query Authors View
Views use extra disk space in exchange
for additional performance. Consider
the design of your views accordingly.
Lesson
HTTP API
Resources
• URI identi es a resource
• resource could be a:
  • database
    http://localhost:5984/books
  • document
    http://localhost:5984/books/978-0-596-15589-6
  • attachment
    http://localhost:5984/books/978-0-596-15589-6/cover.gif
  • con guration section
    http://localhost:5984/_config/uuids
Methods
• HTTP methods de ne actions on resources
• HTTP methods used in CouchDB include:
  • GET
  • POST
  • PUT
  • DELETE
Self-Describing Messages
• HTTP request headers:
  • Accept
  • Content-Type
• HTTP response status codes:
  • 200 OK
  • 201 Created
  • 409 Con ict
• HTTP response headers:
  • Content-Type
  • Etag
Conditional caching can be done with
the Etag HTTP response header and the
If-None-Match HTTP request header.
Hypermedia Controls
• not part of the core API*
• can be created with a combination of:
  • show functions
  • list functions
  • document update handlers




                     *One   might argue that a document identi er could serve as a form of hypermedia control.
cURL [1]

 • tool for transferring data
 • understands many protocols, including HTTP
 • both a library and a command-line tool




                                                1. http://curl.haxx.se/
Useful cURL Switches
• -d HTTP POST data
   • --data-urlencode HTTP POST data url encoded
• -G Send the -d data with a HTTP GET
• -H Custom header to pass to server
• -i Include protocol headers in the output
• -X Specify request command to use
Lab
cURL and CouchDB
Install cURL
1. Install cURL command-line tool using your package manager
   OR
   Download and install cURL executable[1]
2. Test cURL and CouchDB:
  $ curl -iX GET 'http://localhost:5984/'




                                             1. http://curl.haxx.se/dlwiz/?type=bin
Install cURL
1. Install cURL command-line tool using your package manager
   OR
   Download and install cURL executable[1]
2. Test cURL and CouchDB:
  $ curl -iX GET 'http://localhost:5984/'

  HTTP/1.1 200 OK
  Server: CouchDB/1.1.0 (Erlang OTP/R14B03)
  Date: Tue, 11 Oct 2011 16:21:40 GMT
  Content-Type: text/plain;charset=utf-8
  Content-Length: 40
  Cache-Control: must-revalidate
  {"couchdb":"Welcome","version":"1.1.0"}
                                             1. http://curl.haxx.se/dlwiz/?type=bin
Accept JSON
1. Tell CouchDB that you can accept JSON:
  $ curl -iX GET 'http://localhost:5984/'
  -H 'Accept: application/json'
Accept JSON
1. Tell CouchDB that you can accept JSON:
  $ curl -iX GET 'http://localhost:5984/'
  -H 'Accept: application/json'

  HTTP/1.1 200 OK
  Server: CouchDB/1.1.0 (Erlang OTP/R14B03)
  Date: Tue, 11 Oct 2011 16:51:40 GMT
  Content-Type: application/json
  Content-Length: 40
  Cache-Control: must-revalidate
  {"couchdb":"Welcome","version":"1.1.0"}
Create a Database
1. PUT a new database into CouchDB:
  $ curl -iX PUT 'http://localhost:5984/mydb'
Create a Database
1. PUT a new database into CouchDB:
  $ curl -iX PUT 'http://localhost:5984/mydb'

  HTTP/1.1 201 Created
  Location: http://localhost:5984/mydb
  {"ok":true}
Create a Document
1. POST a new document into a CouchDB database:
  $ curl -iX POST 'http://localhost:5984/mydb'
  -H 'Content-Type: application/json'
  -d '{"_id":"mydoc"}'
Create a Document
1. POST a new document into a CouchDB database:
  $ curl -iX POST 'http://localhost:5984/mydb'
  -H 'Content-Type: application/json'
  -d '{"_id":"mydoc"}'

  HTTP/1.1 201 Created
  Location: http://localhost:5984/mydb/mydoc
  {
      "ok":true,
      "id":"mydoc",
      "rev":"1-967a00dff5e02add41819138abb3284d"
  }
Read the Document
1. GET a document:
  $ curl -iX GET 'http://localhost:5984/mydb/mydoc'
Read the Document
1. GET a document:
  $ curl -iX GET 'http://localhost:5984/mydb/mydoc'

  HTTP/1.1 200 OK
  Etag: "1-967a00dff5e02add41819138abb3284d"
  {
      "_id":"mydoc",
      "_rev":"1-967a00dff5e02add41819138abb3284d"
  }
Update the Document
1. PUT an updated document:
  $ curl -iX PUT 'http://localhost:5984/mydb/mydoc'
  -H 'If-Match: "1-967a00dff5e02add41819138abb3284d"'
  -H 'Content-Type: application/json'
  -d '{"title":"Learning CouchDB"}'
Update the Document
1. PUT an updated document:
  $ curl -iX PUT 'http://localhost:5984/mydb/mydoc'
  -H 'If-Match: "1-967a00dff5e02add41819138abb3284d"'
  -H 'Content-Type: application/json'
  -d '{"title":"Learning CouchDB"}'

  HTTP/1.1 201 Created
  Location: http://localhost:5984/mydb/mydoc
  Etag: "2-516027e3179a22a22e06874c374e8ef0"
  {
      "ok":true,
      "id":"mydoc",
      "rev":"2-516027e3179a22a22e06874c374e8ef0"
  }
Read the Document
1. GET the document again:
  $ curl -iX GET 'http://localhost:5984/mydb/mydoc'
Read the Document
1. GET the document again:
  $ curl -iX GET 'http://localhost:5984/mydb/mydoc'

  HTTP/1.1 200 OK
  Etag: "2-516027e3179a22a22e06874c374e8ef0"
  {
      "_id":"mydoc",
      "_rev":"2-516027e3179a22a22e06874c374e8ef0",
      "title":"Learning CouchDB"
  }
Delete the Document
1. DELETE the document:
  $ curl -iX DELETE 'http://localhost:5984/mydb/mydoc'
  -H 'If-Match: "2-516027e3179a22a22e06874c374e8ef0"'
Delete the Document
1. DELETE the document:
  $ curl -iX DELETE 'http://localhost:5984/mydb/mydoc'
  -H 'If-Match: "2-516027e3179a22a22e06874c374e8ef0"'

  HTTP/1.1 200 OK
  Etag: "3-e9a5aa1c486eee23c84fa028bc904991"
  {
      "ok":true,
      "id":"mydoc",
      "rev":"3-e9a5aa1c486eee23c84fa028bc904991"
  }
Delete the Database
1. DELETE the database:
  $ curl -iX DELETE 'http://localhost:5984/mydb'
Delete the Database
1. DELETE the database:
  $ curl -iX DELETE 'http://localhost:5984/mydb'

  HTTP/1.1 200 OK
  {"ok":true}
Lesson
CouchDB Libraries for PHP
HTTP Clients
• Zend_Http_Client[1]
  • a Zend Framework component
  • relatively easy-to-use API
• PHP’s cURL extension[2]
  • commonly installed extension
  • less intuitive API
• HTTP_Request2[3]
  • a PEAR component


                                   1. http://framework.zend.com/manual/en/zend.http.html
                                   2. http://php.net/manual/en/book.curl.php
                                   3. http://pear.php.net/package/HTTP_Request2
Sag for         CouchDB[1]

• accepts PHP data structures (e.g. objects, strings)
• can return raw JSON
• can return a PHP object




                                                   1. http://www.saggingcouch.com/
PHP       Object_Freezer[1]

•   created and maintained by Sebastian Bergmann
•   “freezes” and “thaws” PHP objects
•   extensible storage options
•   includes CouchDB object storage
•   installable through pear:
    $ pear channel-discover pear.phpunit.de
    $ pear install phpunit/Object_Freezer




                                   1. https://github.com/sebastianbergmann/php-object-freezer
PHP CouchDB                     Extension[1]

• supports a large part of the CouchDB API
• supports both cookie and basic authentication
• automatically encodes and decodes JSON to and from PHP
    objects and arrays
•   available as a PECL extension




                                    1. http://www.topdog.za.net/php_couchdb_extension
Doctrine2 CouchDB                             ODM[1]

• a mapper between PHP objects and CouchDB documents
• uses metadata mapping pattern to map documents to plain
    old PHP objects
•   potentially good t if you’re already using Doctrine




                                              1. https://github.com/doctrine/couchdb-odm
Others
•   PHP On Couch[1]
•   Chill[2]
•   Settee[3]
•   PHPillow[4]*




                      1. https://github.com/dready92/PHP-on-Couch
                      2. https://github.com/dancryer/Chill
                      3. https://github.com/inadarei/settee
                      4. http://arbitracker.org/phpillow.html
                      *PHPillow does not appear to be maintained.
Lesson
Querying Views
To Reduce or Not To Reduce
• results will not be reduced if no Reduce function is de ned
• by default, results will be reduced
• to not reduce, set the reduce parameter to false
Key Matching
•   by default, all rows will be returned
•   results can be ltered with a key parameter
•   the key parameter can be set to any valid JSON value
•   valid JSON values include a:
    • String
    • Number
    • Boolean
    • JSON Array
    • JSON Object
•   must be URL encoded in a query string
•   zero, one ore more rows matching the key will be returned
Start and End Key Range
•   startkey parameter can de ne the beginning of a range
•   endkey parameter can de ne the end of a range
•   startkey and endkey parameters can be any valid JSON value
•   startkey and endkey parameters must be URL encoded
•   startkey_docid parameter further re nes the start of a range
•   endkey_docid parameter further re nes the end of a range
•   since they reference document identi ers, the startkey_docid
    and endkey_docid parameters must be strings
Limiting, Skipping
and Reversing
•   limit parameter speci es a maximum number of rows
•   skip parameter speci es a number of rows to skip over
•   to reverse results, set the descending parameter to true
•   when reversing results, swap your startkey/startkey_docid
    parameters with your endkey/endkey_docid parameters
Grouping
• to group results by exact key, set the group parameter to true
• group_level parameter is useful if view’s keys are JSON Arrays,
 otherwise known as compound keys
 • a group_level of 1 will only group on the rst items in the
   arrays, ignoring any subsequent array elements
 • a group_level of 2 will only group on the rst and second
   items in the arrays, ignoring any subsequent array elements
 • a group_level of 3 will only group on the rst, second and
   third items in the arrays, ignoring any subsequent array
   elements
 •…
Including Documents
• original document from which each row was emitted can be
    included by setting the include_docs parameter to true
•   this will add a doc eld to your output rows
•   if the value emitted from the Map function is a JSON Object
    containing an _id eld, then CouchDB will instead include the
    document with an identi er matching the value of this eld
Stale Views
• by default, views are incrementally updated when queried
• set the stale parameter’s value to ok to avoid a view update
• if any documents have been created, updated or deleted then
    this will return results faster
•   however, it will return possibly outdated results
•   set the stale parameter’s value to update_after to get stale
    results, but trigger a view update after results are returned
Lab
Querying Views using Zend_Http_Client
Setting up Zend_Http_Client
Install Zend Framework                                            :02

1. If not already in your include path, install Zend Framework:
  $ pear channel-discover pear.zfcampus.org
  $ pear install zfcampus/zf
Interactive PHP Shell               :01

1. Open an interactive PHP shell:
  $ php -a
Set Up Autoloader                            :02

require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
All Rows
Reduced                                               :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/authors');
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Reduced
       key                 value
             Array (
               [sum] => 3008
               [count] => 7
NULL           [min] => 272
               [max] => 648
               [sumsqr] => 1463168
             )
Not Reduced                                           :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/authors');
$client->setParameterGet('reduce', 'false');
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Not Reduced
          id                    key                value
"978-0-596-15589-6"   "J. Chris Anderson"    272

"978-0-596-15589-6"   "Jan Lehnardt"         272

"978-1-565-92580-9"   "Leonard Muellner"     648

"978-0-596-52926-0"   "Leonard Richardson"   448

"978-0-596-15589-6"   "Noah Slater"          272

"978-1-565-92580-9"   "Norman Walsh"         648

"978-0-596-52926-0"   "Sam Ruby"             448
Range Queries
By Key                                                :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/formats');
$client->setParameterGet('reduce', 'false');
$client->setParameterGet('key', '"Print"');
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
By Key
          id                    key         value
"978-0-596-15589-6"   "Print"         272

"978-0-596-52926-0"   "Print"         448

"978-1-565-92580-9"   "Print"         648
By Start and End Keys                                 :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/authors');
$client->setParameterGet('reduce', 'false');
$client->setParameterGet('startkey', '"j"');
$client->setParameterGet('endkey', '"jufff0"');
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
By Start and End Keys
          id                    key               value
"978-0-596-15589-6"   "J. Chris Anderson"   272

"978-0-596-15589-6"   "Jan Lehnardt"        272
Limiting, Skipping and Reversing
Limit Results                                         :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/formats');
$client->setParameterGet('reduce', 'false');
$client->setParameterGet('limit', 5);
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Limit Results
          id                    key         value
"978-0-596-15589-6"   "Ebook"         272

"978-0-596-52926-0"   "Ebook"         448

"978-0-596-15589-6"   "Print"         272

"978-0-596-52926-0"   "Print"         448

"978-1-565-92580-9"   "Print"         648
Skipping Results                                      :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/formats');
$client->setParameterGet('reduce', 'false');
$client->setParameterGet('limit', 5);
$client->setParameterGet('skip', 5);
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Skipping Results
          id                    key                 value
"978-0-596-15589-6"   "Safari Books Online"   272

"978-0-596-52926-0"   "Safari Books Online"   448
Although the skip and limit parameters
can be used together to implement
pagination, this can be inefficient on
large data sets.
First Page
          id                    key         value
"978-0-596-15589-6"   "Ebook"         272

"978-0-596-52926-0"   "Ebook"         448

"978-0-596-15589-6"   "Print"         272

"978-0-596-52926-0"   "Print"         448

"978-1-565-92580-9"   "Print"         648
Next Page                                                     :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/formats');
$client->setParameterGet('reduce', 'false');
$client->setParameterGet('limit', 5);
$client->setParameterGet('startkey', '"Print"');
$client->setParameterGet('startkey_docid', '978-1-565-92580-9');
$client->setParameterGet('skip', 1);
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Next Page
          id                    key                 value
"978-0-596-15589-6"   "Safari Books Online"   272

"978-0-596-52926-0"   "Safari Books Online"   448
Reversing Results                                     :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/titles');
$client->setParameterGet('reduce', 'false');
$client->setParameterGet('descending', 'true');
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Reversing Results
        id                         key                       value
"978-0-596-52926-0"   "RESTful Web Services"           448

"978-1-565-92580-9"   "DocBook: The Definitive Guide"   648

"978-0-596-15589-6"   "CouchDB: The Definitive Guide"   272
Grouping
Exact Grouping                                        :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/formats');
$client->setParameterGet('group', 'true');
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Exact Grouping
                 key                           value
                        Array (
                          [sum] => 720
                          [count] => 2
"Ebook"                   [min] => 272
                          [max] => 448
                          [sumsqr] => 274688
                        )

                        Array (
                          [sum] => 1368
                          [count] => 3
"Print"                   [min] => 272
                          [max] => 648
                          [sumsqr] => 694592
                        )

                        Array (
                          [sum] => 720
                          [count] => 2
"Safari Books Online"     [min] => 272
                          [max] => 448
                          [sumsqr] => 274688
                        )
What We’re Doing Next
• adding a fourth book document with a released date of
    2010-01-08
•   this is the same year and month as another book’s released
    date
•   creating a new releases view that indexes books by their
    released dates
•   releases view will use a compound key—a three-level JSON
    Array of year, month and day
Add a Fourth Document                                           :05

$book = array(
 '_id'      => '978-0-596-80579-1',
 'title'    => 'Building iPhone Apps with HTML, CSS, and JavaScript',
 'subtitle' => 'Making App Store Apps Without Objective-C or Cocoa',
 'authors' => array('Jonathan Stark'),
 'publisher'=> 'O'Reilly Media',
 'formats' => array('Print', 'Ebook', 'Safari Books Online'),
 'released' => '2010-01-08',
 'pages'    => 192
);
$client = new Zend_Http_Client();
$client->setUri('http://127.0.0.1:5984/books');
$client->setHeaders('Content-Type', 'application/json');
$client->setRawData(Zend_Json::encode($book));
$response = $client->request(Zend_Http_Client::POST);
print_r($response->getStatus()); // 201
Releases View                                                    :05

1. In the books database in Futon, select Temporary view… from the
   View select menu
2. Enter the following into the View Code text area:
   function(doc) {
     if (doc.released) {
        emit(doc.released.split("-"), doc.pages);
     }
   }
3. Enter the following in the Reduce Function text area:
   _stats
4. Click Save As…
5. Enter “default” as the Design Document name
6. Enter “releases” as the View Name
7. Click Save
Exact Grouping                                        :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/releases');
$client->setParameterGet('group', 'true');
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Exact Grouping
                key                          value
Array (               Array (
                        [sum] => 648
  [0] => 1999           [count] => 1
  [1] => 10             [min] => 648
  [2] => 28             [max] => 648
                        [sumsqr] => 419904
)                     )


Array (               Array (
                        [sum] => 448
  [0] => 2007           [count] => 1
  [1] => 05             [min] => 448
  [2] => 08             [max] => 448
                        [sumsqr] => 200704
)                     )


Array (               Array (
                        [sum] => 192
  [0] => 2010           [count] => 1
  [1] => 01             [min] => 192
  [2] => 08             [max] => 192
                        [sumsqr] => 36864
)                     )


Array (               Array (
                        [sum] => 272
  [0] => 2010           [count] => 1
  [1] => 01             [min] => 272
  [2] => 19             [max] => 272
                        [sumsqr] => 73984
)                     )
Group Level 1                                         :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/releases');
$client->setParameterGet('group_level', 1);
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Group Level 1
                key                          value
                      Array (
                        [sum] => 648
Array (                 [count] => 1
  [0] => 1999           [min] => 648
                        [max] => 648
)                       [sumsqr] => 419904
                      )

                      Array (
                        [sum] => 448
Array (                 [count] => 1
  [0] => 2007           [min] => 448
                        [max] => 448
)                       [sumsqr] => 200704
                      )

                      Array (
                        [sum] => 464
Array (                 [count] => 2
  [0] => 2010           [min] => 192
                        [max] => 272
)                       [sumsqr] => 110848
                      )
Group Level 2                                         :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/releases');
$client->setParameterGet('group_level', 2);
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Group Level 2
                key                          value
                      Array (
Array (                 [sum] => 648
  [0] => 1999           [count] => 1
                        [min] => 648
  [1] => 10             [max] => 648
)                     )
                        [sumsqr] => 419904



                      Array (
Array (                 [sum] => 448
  [0] => 2007           [count] => 1
                        [min] => 448
  [1] => 05             [max] => 448
)                     )
                        [sumsqr] => 200704



                      Array (
Array (                 [sum] => 464
  [0] => 2010           [count] => 2
                        [min] => 192
  [1] => 01             [max] => 272
)                     )
                        [sumsqr] => 110848
Including Documents
Including Docs                                        :05

$db = 'http://127.0.0.1:5984/books';
$client = new Zend_Http_Client();
$client->setUri($db . '/_design/default/_view/titles');
$client->setParameterGet('reduce', 'false');
$client->setParameterGet('include_docs', 'true');
$client->setHeaders('Accept', 'application/json');
$response = $client->request(Zend_Http_Client::GET);
$body = $response->getBody();
$results = Zend_Json::decode($body);
print_r($results);
Including Docs
        id                     key             value                       doc
                                                       Array (
                      "Building iPhone Apps              [_id] => 978-0-596-80579-1
"978-0-596-80579-1"   with HTML, CSS, and      192       [_rev] => 1-09ce09fef75068834da99957c7b14cf2
                      JavaScript"                        …
                                                       )


                                                       Array (
                      "CouchDB: The                      [_id] => 978-0-596-15589-6
"978-0-596-15589-6"                            272       [_rev] => 2-099d205cbb59d989700ad7692cbb3e66
                      Definitive Guide"                   …
                                                       )


                                                       Array (
                      "DocBook: The                      [_id] => 978-1-565-92580-9
"978-1-565-92580-9"                            648       [_rev] => 1-b945cb4799a1ccdd1689eae0e44124f1
                      Definitive Guide"                   …
                                                       )


                                                       Array (
                                                         [_id] => 978-0-596-52926-0
"978-0-596-52926-0"   "RESTful Web Services"   448       [_rev] => 2-de467b329baf6259e791b830cc950ece
                                                         …
                                                       )
More CouchDB Features
Multi-Master Replication
•   peer-based and bi-directional
•   no explicit cluster setup required
•   synchronization is incremental
•   changes feed allows for replication to other systems
Couchbase Mobile[1]
for iOS and Android

1. http://www.couchbase.com/products-and-services/couchbase-mobile
Horizontally Scalable
• shared nothing architecture
• non-blocking reads and writes for high concurrency
• fault tolerant, isolated messages
ACID Compliant
Atomicity: individual document updates are “all or nothing”

Consistency: queries will be “point in time” consistent

Isolation: updates isolated to document revision number

Durability: success code is returned only after data is on disk
Authentication
•   special _users database
•   basic access authentication
•   cookie authentication
•   OAuth support
Security Model
•   server admins
•   database admins
•   database readers
•   document-level authorization with validation functions
Web Server
•   static les as attachments (e.g. HTML, Javascript, CSS)
•   URL rewriting
•   HTTP proxying
•   HTTP range requests
•   SSL support
•   virtual hosts
Application Server
• show functions
• list functions
• document update handlers
Load Balancing
Clustering
• Lounge[1]
• Pillow[2]
• BigCouch[3]




                1. http://tilgovi.github.com/couchdb-lounge/
                2. https://github.com/khellan/Pillow
                3. https://github.com/cloudant/bigcouch
Extensible
• GeoCouch[1] for geospatial indexing
• couchdb-lucene[2] for full text indexing
• ElasticSearch[3] for full text indexing




                            1. https://github.com/couchbase/geocouch
                            2. https://github.com/rnewson/couchdb-lucene
                            3. http://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration.html
Resources
Hosting
Iris Couch
   • Free (for now)
   • Couchbase server
   • GeoCouch geospatial indexing
   • http://www.iriscouch.com
Cloudant
  • Various pricing levels
  • Full-text searching
  • Ad-hoc queries
  • Elastic scaling, clustering and sharding using BigCouch
  • https://cloudant.com
Documentation and Books
CouchDB Wiki                      Scaling CouchDB
http://wiki.apache.org/couchdb/   by Bradley Holt (O’Reilly)
                                  978-1-4493-0343-3
CouchDB: The De nitive Guide
by J. Chris Anderson, Jan         Getting Started with CouchDB
Lehnardt and Noah Slater          by MC Brown (O’Reilly)
(O’Reilly)                        978-1-4493-0755-4
978-0-596-15589-6
                                  Beginning CouchDB
Writing and Querying MapReduce    by Joe Lennon (Apress)
Views in CouchDB                  978-1-430-27237-3
by Bradley Holt (O’Reilly)
978-1-449-30312-9
http://oreilly.com/catalog/9781449303129/   http://oreilly.com/catalog/9781449303433/
Questions?
Thank You
                                  @BradleyHolt
                             http://bradley-holt.com
                           bradley.holt@foundline.com




Copyright © 2011 Bradley Holt. All rights reserved.
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB

More Related Content

Viewers also liked

CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...
CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...
CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...StampedeCon
 
Migrating to CouchDB
Migrating to CouchDBMigrating to CouchDB
Migrating to CouchDBJohn Wood
 
Couch Db In 60 Minutes
Couch Db In 60 MinutesCouch Db In 60 Minutes
Couch Db In 60 MinutesGeorge Ang
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHPBradley Holt
 
Couch db@nosql+taiwan
Couch db@nosql+taiwanCouch db@nosql+taiwan
Couch db@nosql+taiwanKenzou Yeh
 
CouchDB – A Database for the Web
CouchDB – A Database for the WebCouchDB – A Database for the Web
CouchDB – A Database for the WebKarel Minarik
 
CouchApps: Requiem for Accidental Complexity
CouchApps: Requiem for Accidental ComplexityCouchApps: Requiem for Accidental Complexity
CouchApps: Requiem for Accidental ComplexityFederico Galassi
 
Real World CouchDB
Real World CouchDBReal World CouchDB
Real World CouchDBJohn Wood
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDBDavid Coallier
 

Viewers also liked (16)

CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...
CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...
CouchDB at its Core: Global Data Storage and Rich Incremental Indexing at Clo...
 
Migrating to CouchDB
Migrating to CouchDBMigrating to CouchDB
Migrating to CouchDB
 
CouchDB-Lucene
CouchDB-LuceneCouchDB-Lucene
CouchDB-Lucene
 
Apache CouchDB
Apache CouchDBApache CouchDB
Apache CouchDB
 
Couch Db In 60 Minutes
Couch Db In 60 MinutesCouch Db In 60 Minutes
Couch Db In 60 Minutes
 
Couch db
Couch dbCouch db
Couch db
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHP
 
Couch db@nosql+taiwan
Couch db@nosql+taiwanCouch db@nosql+taiwan
Couch db@nosql+taiwan
 
CouchDB – A Database for the Web
CouchDB – A Database for the WebCouchDB – A Database for the Web
CouchDB – A Database for the Web
 
Couch db
Couch dbCouch db
Couch db
 
CouchDB
CouchDBCouchDB
CouchDB
 
CouchApps: Requiem for Accidental Complexity
CouchApps: Requiem for Accidental ComplexityCouchApps: Requiem for Accidental Complexity
CouchApps: Requiem for Accidental Complexity
 
CouchDB Vs MongoDB
CouchDB Vs MongoDBCouchDB Vs MongoDB
CouchDB Vs MongoDB
 
Real World CouchDB
Real World CouchDBReal World CouchDB
Real World CouchDB
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDB
 
CouchDB
CouchDBCouchDB
CouchDB
 

Similar to ZendCon 2011 Learning CouchDB

Nosql availability & integrity
Nosql availability & integrityNosql availability & integrity
Nosql availability & integrityFahri Firdausillah
 
What Is Super Key In Dbms
What Is Super Key In DbmsWhat Is Super Key In Dbms
What Is Super Key In DbmsTheresa Singh
 
Mapping objects to_relational_databases
Mapping objects to_relational_databasesMapping objects to_relational_databases
Mapping objects to_relational_databasesIvan Paredes
 
Ling liu part 02:big graph processing
Ling liu part 02:big graph processingLing liu part 02:big graph processing
Ling liu part 02:big graph processingjins0618
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
01 Persistence And Orm
01 Persistence And Orm01 Persistence And Orm
01 Persistence And OrmRanjan Kumar
 
No Sql On Social And Sematic Web
No Sql On Social And Sematic WebNo Sql On Social And Sematic Web
No Sql On Social And Sematic WebStefan Ceriu
 
NoSQL On Social And Sematic Web
NoSQL On Social And Sematic WebNoSQL On Social And Sematic Web
NoSQL On Social And Sematic WebStefan Prutianu
 
SQL and NoSQL in SQL Server
SQL and NoSQL in SQL ServerSQL and NoSQL in SQL Server
SQL and NoSQL in SQL ServerMichael Rys
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
0001 introduction to database management system
0001 introduction to database management system0001 introduction to database management system
0001 introduction to database management systemJugdambay S
 
EMR: A Scalable Graph-based Ranking Model for Content-based Image Retrieval
EMR: A Scalable Graph-based Ranking Model for Content-based Image RetrievalEMR: A Scalable Graph-based Ranking Model for Content-based Image Retrieval
EMR: A Scalable Graph-based Ranking Model for Content-based Image Retrieval1crore projects
 
Emr a scalable graph based ranking model for content-based image retrieval
Emr a scalable graph based ranking model for content-based image retrievalEmr a scalable graph based ranking model for content-based image retrieval
Emr a scalable graph based ranking model for content-based image retrievalPvrtechnologies Nellore
 
Challenges on Distributed Machine Learning
Challenges on Distributed Machine LearningChallenges on Distributed Machine Learning
Challenges on Distributed Machine Learningjie cao
 

Similar to ZendCon 2011 Learning CouchDB (20)

Nosql availability & integrity
Nosql availability & integrityNosql availability & integrity
Nosql availability & integrity
 
What Is Super Key In Dbms
What Is Super Key In DbmsWhat Is Super Key In Dbms
What Is Super Key In Dbms
 
Mapping objects to_relational_databases
Mapping objects to_relational_databasesMapping objects to_relational_databases
Mapping objects to_relational_databases
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
Ling liu part 02:big graph processing
Ling liu part 02:big graph processingLing liu part 02:big graph processing
Ling liu part 02:big graph processing
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Why you should(n't) run your databases in the cloud
Why you should(n't) run your databases in the cloudWhy you should(n't) run your databases in the cloud
Why you should(n't) run your databases in the cloud
 
01 Persistence And Orm
01 Persistence And Orm01 Persistence And Orm
01 Persistence And Orm
 
Nosql databases
Nosql databasesNosql databases
Nosql databases
 
No Sql On Social And Sematic Web
No Sql On Social And Sematic WebNo Sql On Social And Sematic Web
No Sql On Social And Sematic Web
 
NoSQL On Social And Sematic Web
NoSQL On Social And Sematic WebNoSQL On Social And Sematic Web
NoSQL On Social And Sematic Web
 
SQL and NoSQL in SQL Server
SQL and NoSQL in SQL ServerSQL and NoSQL in SQL Server
SQL and NoSQL in SQL Server
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
0001 introduction to database management system
0001 introduction to database management system0001 introduction to database management system
0001 introduction to database management system
 
EMR: A Scalable Graph-based Ranking Model for Content-based Image Retrieval
EMR: A Scalable Graph-based Ranking Model for Content-based Image RetrievalEMR: A Scalable Graph-based Ranking Model for Content-based Image Retrieval
EMR: A Scalable Graph-based Ranking Model for Content-based Image Retrieval
 
NoSQL
NoSQLNoSQL
NoSQL
 
Emr a scalable graph based ranking model for content-based image retrieval
Emr a scalable graph based ranking model for content-based image retrievalEmr a scalable graph based ranking model for content-based image retrieval
Emr a scalable graph based ranking model for content-based image retrieval
 
Challenges on Distributed Machine Learning
Challenges on Distributed Machine LearningChallenges on Distributed Machine Learning
Challenges on Distributed Machine Learning
 
Hibernate I
Hibernate IHibernate I
Hibernate I
 

More from Bradley Holt

Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Bradley Holt
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven DesignBradley Holt
 
Entity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonEntity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonBradley Holt
 
CouchConf NYC CouchApps
CouchConf NYC CouchAppsCouchConf NYC CouchApps
CouchConf NYC CouchAppsBradley Holt
 
ZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignBradley Holt
 
jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsBradley Holt
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchAppsBradley Holt
 
OSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBOSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBBradley Holt
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with ApacheBradley Holt
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3Bradley Holt
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHPBradley Holt
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web ServicesBradley Holt
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughBradley Holt
 
Burlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBurlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBradley Holt
 

More from Bradley Holt (15)

Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Entity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonEntity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf Boston
 
CouchConf NYC CouchApps
CouchConf NYC CouchAppsCouchConf NYC CouchApps
CouchConf NYC CouchApps
 
ZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven Design
 
jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchApps
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchApps
 
OSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBOSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDB
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with Apache
 
Intermediate PHP
Intermediate PHPIntermediate PHP
Intermediate PHP
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
 
Burlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBurlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion Presentation
 

Recently uploaded

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Recently uploaded (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

ZendCon 2011 Learning CouchDB

  • 1. Learning CouchDB A Non-Relational Alternative to Data Persistence for Modern Software Applications
  • 2. Is CouchDB a good choice for your application?
  • 3. Problem: The Object-Relational Impedance Mismatch [1] How to persist data in an object-oriented software application? 1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch 2. http://martinfowler.com/eaaCatalog/repository.html 3. http://c2.com/cgi/wiki?ObjectRelationalMapping
  • 4. Problem: The Object-Relational Impedance Mismatch [1] How to persist data in an object-oriented software application? 1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch 2. http://martinfowler.com/eaaCatalog/repository.html 3. http://c2.com/cgi/wiki?ObjectRelationalMapping
  • 5. Problem: The Object-Relational Impedance Mismatch [1] How to persist data in an object-oriented software application? s eparate domain a nd data mapping layers[2] 1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch 2. http://martinfowler.com/eaaCatalog/repository.html 3. http://c2.com/cgi/wiki?ObjectRelationalMapping
  • 6. Problem: The Object-Relational Impedance Mismatch [1] How to persist data in an object-oriented software application? s eparate domain a nd data mapping layers[2] object-relational mapping (ORM)[3] 1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch 2. http://martinfowler.com/eaaCatalog/repository.html 3. http://c2.com/cgi/wiki?ObjectRelationalMapping
  • 7. Problem: The Object-Relational Impedance Mismatch [1] How to persist data in an object-oriented software application? s eparate domain a nd data mapping non-relational layers[2] database object-relational mapping (ORM)[3] 1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch 2. http://martinfowler.com/eaaCatalog/repository.html 3. http://c2.com/cgi/wiki?ObjectRelationalMapping
  • 8. Problem: The Object-Relational Impedance Mismatch [1] How to persist data in an object-oriented software application? s eparate domain a nd data mapping non-relational layers[2] database object-relational mapping (ORM)[3] 1. http://c2.com/cgi/wiki?ObjectRelationalImpedanceMismatch 2. http://martinfowler.com/eaaCatalog/repository.html 3. http://c2.com/cgi/wiki?ObjectRelationalMapping
  • 9. Problem: Semi-Structured Data How to persist data with exible schemas?
  • 10. Problem: Semi-Structured Data How to persist data with exible schemas?
  • 11. Problem: Semi-Structured Data How to persist data with exible schemas? leave non- applicable ll column values nu
  • 12. Problem: Semi-Structured Data How to persist data with exible schemas? use the entity-attribute- value (EAV ) leave anti-pattern[1] non- applicable ll column values nu 1. http://pragprog.com/book/bksqla/sql-antipatterns
  • 13. Problem: Semi-Structured Data How to persist data with exible schemas? use the entity-attribute- value (EAV ) leave anti-pattern[1] use a non- applicable ll schema-less column values nu database with a self-describing structure 1. http://pragprog.com/book/bksqla/sql-antipatterns
  • 14. Problem: Semi-Structured Data How to persist data with exible schemas? use the entity-attribute- value (EAV ) leave anti-pattern[1] use a non- applicable ll schema-less column values nu database with a self-describing structure 1. http://pragprog.com/book/bksqla/sql-antipatterns
  • 15. Problem: Persisting Graph Relationships How to persist graphs, trees and hierarchical data?
  • 16. Problem: Persisting Graph Relationships How to persist graphs, trees and hierarchical data?
  • 17. Problem: Persisting Graph Relationships How to persist graphs, trees and hierarchical data? model hierarchical data in SQL[1] 1. http://www.percona.com/webinars/2011-02-28-models-for-hierarchical-data-in-sql-and-php/ 2. http://www.graph-database.org/
  • 18. Problem: Persisting Graph Relationships How to persist graphs, trees and hierarchical data? model hierarchical data in SQL[1] graph database[2] 1. http://www.percona.com/webinars/2011-02-28-models-for-hierarchical-data-in-sql-and-php/ 2. http://www.graph-database.org/
  • 19. Problem: Persisting Graph Relationships How to persist graphs, trees and hierarchical data? model hierarchical document oriented d - data in SQL[1] graph database[2] ataba se 1. http://www.percona.com/webinars/2011-02-28-models-for-hierarchical-data-in-sql-and-php/ 2. http://www.graph-database.org/
  • 20. Problem: Persisting Graph Relationships How to persist graphs, trees and hierarchical data? model hierarchical document oriented d - data in SQL[1] graph database[2] ataba se 1. http://www.percona.com/webinars/2011-02-28-models-for-hierarchical-data-in-sql-and-php/ 2. http://www.graph-database.org/
  • 21. Problem: Achieving High Concurrency How to give up consistency in exchange for high availability? [1] 1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
  • 22. Problem: Achieving High Concurrency How to give up consistency in exchange for high availability? [1] 1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
  • 23. Problem: Achieving High Concurrency How to give up consistency in exchange for high availability? [1] reduce transaction scope 1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
  • 24. Problem: Achieving High Concurrency How to give up consistency in exchange for high availability? [1] reduce transaction database scope replication 1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
  • 25. Problem: Achieving High Concurrency How to give up consistency in exchange for high availability? [1] reduce transaction database scope replication denormalization 1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
  • 26. Problem: Achieving High Concurrency How to give up consistency in exchange for high availability? [1] reduce transaction database scope replication multi-version concurrency control (MVCC) denormalization 1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
  • 27. Problem: Achieving High Concurrency How to give up consistency in exchange for high availability? [1] reduce transaction database scope replication multi-version concurrency control (MVCC) denormalization 1. http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
  • 28. Problem: Building in Fault-Tolerance How to make a fault-tolerant system?
  • 29. Problem: Building in Fault-Tolerance How to make a fault-tolerant system?
  • 30. Problem: Building in Fault-Tolerance How to make a fault-tolerant system? promote slave database to master on fault
  • 31. Problem: Building in Fault-Tolerance How to make a fault-tolerant system? isolate faults promote slave database to master on fault
  • 32. Problem: Building in Fault-Tolerance How to make a fault-tolerant system? isolate faults promote slave database multi-master to master on fault replication
  • 33. Problem: Building in Fault-Tolerance How to make a fault-tolerant system? isolate faults promote slave database multi-master to master on fault replication
  • 34. Problem: Flexible Indexing How to index data other than direct column values?
  • 35. Problem: Flexible Indexing How to index data other than direct column values?
  • 36. Problem: Flexible Indexing How to index data other than direct column values? d enormalize
  • 37. Problem: Flexible Indexing How to index data other than direct column values? d enormalize user-de ned t ypes
  • 38. Problem: Flexible Indexing How to index data other than direct column values? d enormalize Map/Reduce user-de ned t ypes
  • 39. Problem: Flexible Indexing How to index data other than direct column values? d enormalize Map/Reduce user-de ned t ypes
  • 41. Schema-Less • stores self-contained JSON documents • related entities can be stored in a single document • only store elds that are needed in each document
  • 42. Futon Web Administration • built-in web administration console • default location is: http://localhost:5984/_utils/ • create, read, update and delete databases and documents • query databases • con gure CouchDB • replicate between databases • view task status • run test suite • set up server admins • con gure database security • run compaction and cleanup maintenance tasks
  • 43. CouchDB Views • queries are run against indexed views • views are generated through incremental Map functions • aggregate results can be retrieved through Reduce functions
  • 44. HTTP API • every language and platform has an HTTP client • uses existing semantics (e.g. 201 Created, 202 Accepted) • distributed, scalable and cacheable
  • 45. CouchDB and PHP • can just use an HTTP client • several client libraries speci c to CouchDB are available
  • 46. Flexible Querying Options • all rows in a given view • row(s) matching a speci ed key • rows by start and end keys • exact grouping • group by levels • limit and skip parameters • output in descending order • include original documents in result set
  • 48. CouchDB or Couchbase CouchDB: • project of the Apache Software Foundation • available through package managers Couchbase: • superset of CouchDB • includes geospatial indexing • available as Couchbase Mobile for iOS and Android • commercial support options available
  • 49. CouchDB Installation • Mac OS X • Homebrew • MacPorts • Windows • binary installer[1] • Ubuntu • Aptitude • Red Hat • Yum 1. http://wiki.apache.org/couchdb/Windows_binary_installer
  • 50. Couchbase Single Server[1] Available for: • Mac OS X • Windows • Ubuntu • Red Hat 1. http://www.couchbase.com/products-and-services/couchbase-single-server
  • 52. Installation and Startup :03 1. Install CouchDB OR Install Couchbase Single Server 2. If CouchDB, then at the command-line: $ sudo couchdb Apache CouchDB has started. Time to relax. 3. Optionally, test CouchDB: $ curl 'http://localhost:5984/' {"couchdb":"Welcome","version":"1.1.0"}
  • 54. Why JSON? • human-readable and simple data interchange format • data structures from many programming languages can be easily converted to and from JSON • lightweight—doesn’t add too much to bandwidth overhead
  • 55. JSON Data Types • String • Number • Boolean (false or true) • JSON Array (e.g. ["a", "b", "c"]) • JSON Object: collection of name/value pairs where the name is a String and the value is any valid JSON data type • JSON NULL (null)
  • 56. Example JSON Object { "_id":"978-0-596-15589-6", "title":"CouchDB: The De nitive Guide", "subtitle":"Time to Relax", "authors":[ "J. Chris Anderson", "Jan Lehnardt", "Noah Slater" ], "publisher":"O'Reilly Media", "released":"2010-01-19", "pages":272 }
  • 58. Access Futon :01 1. Visit Futon in your web browser: http://localhost:5984/_utils/ 2. Note the existing _replicator and _users databases 3. Note the Tools navigation section 4. Note the following message: “Welcome to Admin Party!”
  • 60. Create a Database :01 1. Click Create Database … 2. Enter “books” in the Database Name eld 3. Click the Create button
  • 62. Create a Document :05 1. Click New Document 2. Enter “978-0-596-15589-6” as the value for the _id eld, and then click apply 3. Using the Add Field button, add a “title” eld with a value of “CouchDB: The De nitive Guide” 4. Add a “subtitle” eld with a value of “Time to Relax” 5. Add an “authors” eld with a value of: ["J. Chris Anderson", "Jan Lehnardt", "Noah Slater"] 6. Add a “publisher” eld with a value of “O'Reilly Media” 7. Add a “released” eld with a value of “2010-01-19” 8. Add a “pages” eld with a value of “272” 9. Click Save Document
  • 65. Map Functions • used to transform documents into key/value pairs • user-de ned, typically written in JavaScript • every document is incrementally passed through this function • function is passed a JSON object representing a document • function calls an emit function zero, one or more times • emit function accepts two arguments: • a key • a value to be associated with the key • an id eld is implicitly emitted as well
  • 66. Temporary Views • contains a Map function and an optional Reduce function • useful in development • very slow on large data sets
  • 68. Map Book Titles :03 1. Click on the books database in the breadcrumb navigation 2. Select Temporary view… from the View select menu 3. Enter the following in the View Code text area: function(doc) { if (doc.title) { emit(doc.title); } } 4. Click Run
  • 70. Map functions must be deterministic. Given the same input, a Map function must always return the same output.
  • 71. Add a Second Document :05 1. Click New Document 2. Enter “978-0-596-52926-0” as the value for the _id eld, and then click apply 3. Add a “title” eld with a value of “RESTful Web Services” 4. Add a “subtitle” eld with a value of “Web services for the real world” 5. Add an “authors” eld with a value of: ["Leonard Richardson", "Sam Ruby"] 6. Add a “publisher” eld with a value of “O'Reilly Media” 7. Add a “released” eld with a value of “2007-05-08” 8. Add a “pages” eld with a value of “448” 9. Click Save Document
  • 72. Add a Second Document
  • 73. Map Book Titles :01 1. Click on the books database in the breadcrumb navigation 2. If not already selected, select Temporary view… from the View select menu 3. If not already entered, enter the following in the View Code text area: function(doc) { if (doc.title) { emit(doc.title); } } 4. Click Run
  • 76. Add a formats Field :03 1. Navigate to the books database, if not already there 2. Select All documents from the View select menu 3. Click the rst document, 978-0-596-15589-6 4. Add a “formats” eld with a value of: ["Print", "Ebook", "Safari Books Online"] 5. Click Save Document 6. Navigate back to the books database 7. Repeat steps 3 through 6 for the second document, 978-0-596-52926-0
  • 77. When updating documents, you may have noticed the _rev eld, an artifact of CouchDB’s Multi-Version Concurrency Control (MVCC).
  • 78. Add a Third Document :05 1. Click New Document 2. Enter “978-1-565-92580-9” as the value for the _id eld, and then click apply 3. Add a “title” eld with a value of “DocBook: The De nitive Guide” 4. Add an “authors” eld with a value of: ["Norman Walsh", "Leonard Muellner"] 5. Add a “publisher” eld with a value of “O'Reilly Media” 6. Add a “formats” eld with a value of: ["Print"] 7. Add a “released” eld with a value of “1999-10-28” 8. Add a “pages” eld with a value of “648” 9. Click Save Document
  • 79. Add a Third Document
  • 80. Map Book Formats :03 1. Navigate to the books database 2. Select Temporary view… from the View select menu 3. Enter the following in the View Code text area: function(doc) { if (doc.formats) { for (var i in doc.formats) { emit(doc.formats[i]); } } } 4. Click Run
  • 82. Map Book Authors :02 1. Navigate to the books database 2. Select Temporary view… from the View select menu 3. Enter the following in the View Code text area: function(doc) { if (doc.authors) { for (var i in doc.authors) { emit(doc.authors[i]); } } } 4. Click Run
  • 85. Reduce Functions • optional, run against data set produced by a Map function • typically used to reduce a set of values to a single, scalar value • can reference built-in Reduce functions • custom Reduce functions can be written in JavaScript • set of already reduced data may be rereduced • function is passed three arguments: • keys: array of mapped keys and associated document identi ers in the form of [key, id] • values: array of mapped values • rereduce: boolean value indicating whether or not the reduce function is being called recursively on its own output (in which case, keys will be null)
  • 86. Built-In Reduce Functions • written in CouchDB’s native Erlang • faster than user-de ned JavaScript functions • includes: • _count • _sum • _stats
  • 87. If you think that you need to write your own custom Reduce function, you’re probably doing it wrong.
  • 88. Grouping • values can be reduced by group • grouping is controlled by a query, not by the Reduce function • grouping is done by key • key levels, or parts of a key, can also be grouped on
  • 90. The built-in _count function can reduce arbitrary values, including null values.
  • 91. Count: No Grouping :03 1. Select Temporary view… from the View select menu 2. Enter the following in the View Code text area: function(doc) { if (doc.formats) { for (var i in doc.formats) { emit(doc.formats[i]); } } } 3. Enter the following in the Reduce Function text area: _count 4. Click Run 5. Check the Reduce checkbox 6. Select none from the Grouping select menu
  • 93. Count: Exact Grouping :01 1. Select exact from the Grouping select menu
  • 95. The _sum and _stats functions will only reduce sets of numbers.
  • 96. Sum: Exact Grouping :02 1. Update the View Code text area with the following: function(doc) { if (doc.formats) { for (var i in doc.formats) { emit(doc.formats[i], doc.pages); } } } 2. Enter the following in the Reduce Function text area: _sum 3. Click Run 4. The Reduce checkbox should be checked 5. exact should be selected from the Grouping select menu
  • 98. Stats: Exact Grouping :01 1. Enter the following in the Reduce Function text area: _stats 2. Click Run 3. The Reduce checkbox should be checked 4. exact should be selected from the Grouping select menu
  • 100. Map/Reduce gives you tremendous exibility, but has its limitations: no ad-hoc queries* index is one dimensional only key or range queries are allowed† *Temporary views are only useful in development, not in production. †Multiple key queries are allowed, but result in multiple hits on the index.
  • 102. Non-Temporary Views • multiple views can be de ned within a design document • a view contains a Map and an optional Reduce function • a view is recomputed when its design document is updated • views are incrementally re-indexed after documents are created, updated or deleted* *Technically, views are incrementally re-indexed when queried.
  • 103. Contents of a Design Document • view de nitions • Map functions • Reduce functions • show functions • list functions • document update handlers • document update validation functions • rewrite de nitions • arbitrary elds • arbitrary attachments
  • 105. Titles View :05 1. Update the View Code text area with the following: function(doc) { if (doc.title) { emit(doc.title, doc.pages); } } 2. Enter the following in the Reduce Function text area: _stats 3. Click Save As… 4. Enter “default” as the Design Document name 5. Enter “titles” as the View Name 6. Click Save
  • 107. Query Titles View :01 1. Select titles from the View select menu, if not already selected 2. Click arrow next to View Code, if you’d like 3. Check the Reduce checkbox, if not already checked 4. Select none from the Grouping select menu
  • 109. Formats View :05 1. Update the View Code text area with the following: function(doc) { if (doc.formats) { for (var i in doc.formats) { emit(doc.formats[i], doc.pages); } } } 2. Enter the following in the Reduce Function text area: _stats 3. Click Save As… 4. Enter “default” as the Design Document name 5. Enter “formats” as the View Name 6. Click Save
  • 111. Query Formats View :01 1. Select formats from the View select menu, if not already selected 2. Click the arrow next to View Code, if you’d like 3. Check the Reduce checkbox, if not already checked 4. Select none from the Grouping select menu
  • 113. Authors View :05 1. Update the View Code text area with the following: function(doc) { if (doc.authors) { for (var i in doc.authors) { emit(doc.authors[i], doc.pages); } } } 2. Enter the following in the Reduce Function text area: _stats 3. Click Save As… 4. Enter “default” as the Design Document name 5. Enter “authors” as the View Name 6. Click Save
  • 115. Query Authors View :01 1. Select authors from the View select menu, if not already selected 2. Click arrow next to View Code, if you’d like 3. Check the Reduce checkbox, if not already checked 4. Select none from the Grouping select menu
  • 117. Views use extra disk space in exchange for additional performance. Consider the design of your views accordingly.
  • 119. Resources • URI identi es a resource • resource could be a: • database http://localhost:5984/books • document http://localhost:5984/books/978-0-596-15589-6 • attachment http://localhost:5984/books/978-0-596-15589-6/cover.gif • con guration section http://localhost:5984/_config/uuids
  • 120. Methods • HTTP methods de ne actions on resources • HTTP methods used in CouchDB include: • GET • POST • PUT • DELETE
  • 121. Self-Describing Messages • HTTP request headers: • Accept • Content-Type • HTTP response status codes: • 200 OK • 201 Created • 409 Con ict • HTTP response headers: • Content-Type • Etag
  • 122. Conditional caching can be done with the Etag HTTP response header and the If-None-Match HTTP request header.
  • 123. Hypermedia Controls • not part of the core API* • can be created with a combination of: • show functions • list functions • document update handlers *One might argue that a document identi er could serve as a form of hypermedia control.
  • 124. cURL [1] • tool for transferring data • understands many protocols, including HTTP • both a library and a command-line tool 1. http://curl.haxx.se/
  • 125. Useful cURL Switches • -d HTTP POST data • --data-urlencode HTTP POST data url encoded • -G Send the -d data with a HTTP GET • -H Custom header to pass to server • -i Include protocol headers in the output • -X Specify request command to use
  • 127. Install cURL 1. Install cURL command-line tool using your package manager OR Download and install cURL executable[1] 2. Test cURL and CouchDB: $ curl -iX GET 'http://localhost:5984/' 1. http://curl.haxx.se/dlwiz/?type=bin
  • 128. Install cURL 1. Install cURL command-line tool using your package manager OR Download and install cURL executable[1] 2. Test cURL and CouchDB: $ curl -iX GET 'http://localhost:5984/' HTTP/1.1 200 OK Server: CouchDB/1.1.0 (Erlang OTP/R14B03) Date: Tue, 11 Oct 2011 16:21:40 GMT Content-Type: text/plain;charset=utf-8 Content-Length: 40 Cache-Control: must-revalidate {"couchdb":"Welcome","version":"1.1.0"} 1. http://curl.haxx.se/dlwiz/?type=bin
  • 129. Accept JSON 1. Tell CouchDB that you can accept JSON: $ curl -iX GET 'http://localhost:5984/' -H 'Accept: application/json'
  • 130. Accept JSON 1. Tell CouchDB that you can accept JSON: $ curl -iX GET 'http://localhost:5984/' -H 'Accept: application/json' HTTP/1.1 200 OK Server: CouchDB/1.1.0 (Erlang OTP/R14B03) Date: Tue, 11 Oct 2011 16:51:40 GMT Content-Type: application/json Content-Length: 40 Cache-Control: must-revalidate {"couchdb":"Welcome","version":"1.1.0"}
  • 131. Create a Database 1. PUT a new database into CouchDB: $ curl -iX PUT 'http://localhost:5984/mydb'
  • 132. Create a Database 1. PUT a new database into CouchDB: $ curl -iX PUT 'http://localhost:5984/mydb' HTTP/1.1 201 Created Location: http://localhost:5984/mydb {"ok":true}
  • 133. Create a Document 1. POST a new document into a CouchDB database: $ curl -iX POST 'http://localhost:5984/mydb' -H 'Content-Type: application/json' -d '{"_id":"mydoc"}'
  • 134. Create a Document 1. POST a new document into a CouchDB database: $ curl -iX POST 'http://localhost:5984/mydb' -H 'Content-Type: application/json' -d '{"_id":"mydoc"}' HTTP/1.1 201 Created Location: http://localhost:5984/mydb/mydoc { "ok":true, "id":"mydoc", "rev":"1-967a00dff5e02add41819138abb3284d" }
  • 135. Read the Document 1. GET a document: $ curl -iX GET 'http://localhost:5984/mydb/mydoc'
  • 136. Read the Document 1. GET a document: $ curl -iX GET 'http://localhost:5984/mydb/mydoc' HTTP/1.1 200 OK Etag: "1-967a00dff5e02add41819138abb3284d" { "_id":"mydoc", "_rev":"1-967a00dff5e02add41819138abb3284d" }
  • 137. Update the Document 1. PUT an updated document: $ curl -iX PUT 'http://localhost:5984/mydb/mydoc' -H 'If-Match: "1-967a00dff5e02add41819138abb3284d"' -H 'Content-Type: application/json' -d '{"title":"Learning CouchDB"}'
  • 138. Update the Document 1. PUT an updated document: $ curl -iX PUT 'http://localhost:5984/mydb/mydoc' -H 'If-Match: "1-967a00dff5e02add41819138abb3284d"' -H 'Content-Type: application/json' -d '{"title":"Learning CouchDB"}' HTTP/1.1 201 Created Location: http://localhost:5984/mydb/mydoc Etag: "2-516027e3179a22a22e06874c374e8ef0" { "ok":true, "id":"mydoc", "rev":"2-516027e3179a22a22e06874c374e8ef0" }
  • 139. Read the Document 1. GET the document again: $ curl -iX GET 'http://localhost:5984/mydb/mydoc'
  • 140. Read the Document 1. GET the document again: $ curl -iX GET 'http://localhost:5984/mydb/mydoc' HTTP/1.1 200 OK Etag: "2-516027e3179a22a22e06874c374e8ef0" { "_id":"mydoc", "_rev":"2-516027e3179a22a22e06874c374e8ef0", "title":"Learning CouchDB" }
  • 141. Delete the Document 1. DELETE the document: $ curl -iX DELETE 'http://localhost:5984/mydb/mydoc' -H 'If-Match: "2-516027e3179a22a22e06874c374e8ef0"'
  • 142. Delete the Document 1. DELETE the document: $ curl -iX DELETE 'http://localhost:5984/mydb/mydoc' -H 'If-Match: "2-516027e3179a22a22e06874c374e8ef0"' HTTP/1.1 200 OK Etag: "3-e9a5aa1c486eee23c84fa028bc904991" { "ok":true, "id":"mydoc", "rev":"3-e9a5aa1c486eee23c84fa028bc904991" }
  • 143. Delete the Database 1. DELETE the database: $ curl -iX DELETE 'http://localhost:5984/mydb'
  • 144. Delete the Database 1. DELETE the database: $ curl -iX DELETE 'http://localhost:5984/mydb' HTTP/1.1 200 OK {"ok":true}
  • 146. HTTP Clients • Zend_Http_Client[1] • a Zend Framework component • relatively easy-to-use API • PHP’s cURL extension[2] • commonly installed extension • less intuitive API • HTTP_Request2[3] • a PEAR component 1. http://framework.zend.com/manual/en/zend.http.html 2. http://php.net/manual/en/book.curl.php 3. http://pear.php.net/package/HTTP_Request2
  • 147. Sag for CouchDB[1] • accepts PHP data structures (e.g. objects, strings) • can return raw JSON • can return a PHP object 1. http://www.saggingcouch.com/
  • 148. PHP Object_Freezer[1] • created and maintained by Sebastian Bergmann • “freezes” and “thaws” PHP objects • extensible storage options • includes CouchDB object storage • installable through pear: $ pear channel-discover pear.phpunit.de $ pear install phpunit/Object_Freezer 1. https://github.com/sebastianbergmann/php-object-freezer
  • 149. PHP CouchDB Extension[1] • supports a large part of the CouchDB API • supports both cookie and basic authentication • automatically encodes and decodes JSON to and from PHP objects and arrays • available as a PECL extension 1. http://www.topdog.za.net/php_couchdb_extension
  • 150. Doctrine2 CouchDB ODM[1] • a mapper between PHP objects and CouchDB documents • uses metadata mapping pattern to map documents to plain old PHP objects • potentially good t if you’re already using Doctrine 1. https://github.com/doctrine/couchdb-odm
  • 151. Others • PHP On Couch[1] • Chill[2] • Settee[3] • PHPillow[4]* 1. https://github.com/dready92/PHP-on-Couch 2. https://github.com/dancryer/Chill 3. https://github.com/inadarei/settee 4. http://arbitracker.org/phpillow.html *PHPillow does not appear to be maintained.
  • 153. To Reduce or Not To Reduce • results will not be reduced if no Reduce function is de ned • by default, results will be reduced • to not reduce, set the reduce parameter to false
  • 154. Key Matching • by default, all rows will be returned • results can be ltered with a key parameter • the key parameter can be set to any valid JSON value • valid JSON values include a: • String • Number • Boolean • JSON Array • JSON Object • must be URL encoded in a query string • zero, one ore more rows matching the key will be returned
  • 155. Start and End Key Range • startkey parameter can de ne the beginning of a range • endkey parameter can de ne the end of a range • startkey and endkey parameters can be any valid JSON value • startkey and endkey parameters must be URL encoded • startkey_docid parameter further re nes the start of a range • endkey_docid parameter further re nes the end of a range • since they reference document identi ers, the startkey_docid and endkey_docid parameters must be strings
  • 156. Limiting, Skipping and Reversing • limit parameter speci es a maximum number of rows • skip parameter speci es a number of rows to skip over • to reverse results, set the descending parameter to true • when reversing results, swap your startkey/startkey_docid parameters with your endkey/endkey_docid parameters
  • 157. Grouping • to group results by exact key, set the group parameter to true • group_level parameter is useful if view’s keys are JSON Arrays, otherwise known as compound keys • a group_level of 1 will only group on the rst items in the arrays, ignoring any subsequent array elements • a group_level of 2 will only group on the rst and second items in the arrays, ignoring any subsequent array elements • a group_level of 3 will only group on the rst, second and third items in the arrays, ignoring any subsequent array elements •…
  • 158. Including Documents • original document from which each row was emitted can be included by setting the include_docs parameter to true • this will add a doc eld to your output rows • if the value emitted from the Map function is a JSON Object containing an _id eld, then CouchDB will instead include the document with an identi er matching the value of this eld
  • 159. Stale Views • by default, views are incrementally updated when queried • set the stale parameter’s value to ok to avoid a view update • if any documents have been created, updated or deleted then this will return results faster • however, it will return possibly outdated results • set the stale parameter’s value to update_after to get stale results, but trigger a view update after results are returned
  • 160. Lab Querying Views using Zend_Http_Client
  • 162. Install Zend Framework :02 1. If not already in your include path, install Zend Framework: $ pear channel-discover pear.zfcampus.org $ pear install zfcampus/zf
  • 163. Interactive PHP Shell :01 1. Open an interactive PHP shell: $ php -a
  • 164. Set Up Autoloader :02 require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance();
  • 166. Reduced :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/authors'); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 167. Reduced key value Array ( [sum] => 3008 [count] => 7 NULL [min] => 272 [max] => 648 [sumsqr] => 1463168 )
  • 168. Not Reduced :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/authors'); $client->setParameterGet('reduce', 'false'); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 169. Not Reduced id key value "978-0-596-15589-6" "J. Chris Anderson" 272 "978-0-596-15589-6" "Jan Lehnardt" 272 "978-1-565-92580-9" "Leonard Muellner" 648 "978-0-596-52926-0" "Leonard Richardson" 448 "978-0-596-15589-6" "Noah Slater" 272 "978-1-565-92580-9" "Norman Walsh" 648 "978-0-596-52926-0" "Sam Ruby" 448
  • 171. By Key :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/formats'); $client->setParameterGet('reduce', 'false'); $client->setParameterGet('key', '"Print"'); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 172. By Key id key value "978-0-596-15589-6" "Print" 272 "978-0-596-52926-0" "Print" 448 "978-1-565-92580-9" "Print" 648
  • 173. By Start and End Keys :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/authors'); $client->setParameterGet('reduce', 'false'); $client->setParameterGet('startkey', '"j"'); $client->setParameterGet('endkey', '"jufff0"'); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 174. By Start and End Keys id key value "978-0-596-15589-6" "J. Chris Anderson" 272 "978-0-596-15589-6" "Jan Lehnardt" 272
  • 176. Limit Results :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/formats'); $client->setParameterGet('reduce', 'false'); $client->setParameterGet('limit', 5); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 177. Limit Results id key value "978-0-596-15589-6" "Ebook" 272 "978-0-596-52926-0" "Ebook" 448 "978-0-596-15589-6" "Print" 272 "978-0-596-52926-0" "Print" 448 "978-1-565-92580-9" "Print" 648
  • 178. Skipping Results :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/formats'); $client->setParameterGet('reduce', 'false'); $client->setParameterGet('limit', 5); $client->setParameterGet('skip', 5); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 179. Skipping Results id key value "978-0-596-15589-6" "Safari Books Online" 272 "978-0-596-52926-0" "Safari Books Online" 448
  • 180. Although the skip and limit parameters can be used together to implement pagination, this can be inefficient on large data sets.
  • 181. First Page id key value "978-0-596-15589-6" "Ebook" 272 "978-0-596-52926-0" "Ebook" 448 "978-0-596-15589-6" "Print" 272 "978-0-596-52926-0" "Print" 448 "978-1-565-92580-9" "Print" 648
  • 182. Next Page :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/formats'); $client->setParameterGet('reduce', 'false'); $client->setParameterGet('limit', 5); $client->setParameterGet('startkey', '"Print"'); $client->setParameterGet('startkey_docid', '978-1-565-92580-9'); $client->setParameterGet('skip', 1); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 183. Next Page id key value "978-0-596-15589-6" "Safari Books Online" 272 "978-0-596-52926-0" "Safari Books Online" 448
  • 184. Reversing Results :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/titles'); $client->setParameterGet('reduce', 'false'); $client->setParameterGet('descending', 'true'); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 185. Reversing Results id key value "978-0-596-52926-0" "RESTful Web Services" 448 "978-1-565-92580-9" "DocBook: The Definitive Guide" 648 "978-0-596-15589-6" "CouchDB: The Definitive Guide" 272
  • 187. Exact Grouping :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/formats'); $client->setParameterGet('group', 'true'); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 188. Exact Grouping key value Array ( [sum] => 720 [count] => 2 "Ebook" [min] => 272 [max] => 448 [sumsqr] => 274688 ) Array ( [sum] => 1368 [count] => 3 "Print" [min] => 272 [max] => 648 [sumsqr] => 694592 ) Array ( [sum] => 720 [count] => 2 "Safari Books Online" [min] => 272 [max] => 448 [sumsqr] => 274688 )
  • 189. What We’re Doing Next • adding a fourth book document with a released date of 2010-01-08 • this is the same year and month as another book’s released date • creating a new releases view that indexes books by their released dates • releases view will use a compound key—a three-level JSON Array of year, month and day
  • 190. Add a Fourth Document :05 $book = array( '_id' => '978-0-596-80579-1', 'title' => 'Building iPhone Apps with HTML, CSS, and JavaScript', 'subtitle' => 'Making App Store Apps Without Objective-C or Cocoa', 'authors' => array('Jonathan Stark'), 'publisher'=> 'O'Reilly Media', 'formats' => array('Print', 'Ebook', 'Safari Books Online'), 'released' => '2010-01-08', 'pages' => 192 ); $client = new Zend_Http_Client(); $client->setUri('http://127.0.0.1:5984/books'); $client->setHeaders('Content-Type', 'application/json'); $client->setRawData(Zend_Json::encode($book)); $response = $client->request(Zend_Http_Client::POST); print_r($response->getStatus()); // 201
  • 191. Releases View :05 1. In the books database in Futon, select Temporary view… from the View select menu 2. Enter the following into the View Code text area: function(doc) { if (doc.released) { emit(doc.released.split("-"), doc.pages); } } 3. Enter the following in the Reduce Function text area: _stats 4. Click Save As… 5. Enter “default” as the Design Document name 6. Enter “releases” as the View Name 7. Click Save
  • 192. Exact Grouping :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/releases'); $client->setParameterGet('group', 'true'); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 193. Exact Grouping key value Array ( Array ( [sum] => 648 [0] => 1999 [count] => 1 [1] => 10 [min] => 648 [2] => 28 [max] => 648 [sumsqr] => 419904 ) ) Array ( Array ( [sum] => 448 [0] => 2007 [count] => 1 [1] => 05 [min] => 448 [2] => 08 [max] => 448 [sumsqr] => 200704 ) ) Array ( Array ( [sum] => 192 [0] => 2010 [count] => 1 [1] => 01 [min] => 192 [2] => 08 [max] => 192 [sumsqr] => 36864 ) ) Array ( Array ( [sum] => 272 [0] => 2010 [count] => 1 [1] => 01 [min] => 272 [2] => 19 [max] => 272 [sumsqr] => 73984 ) )
  • 194. Group Level 1 :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/releases'); $client->setParameterGet('group_level', 1); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 195. Group Level 1 key value Array ( [sum] => 648 Array ( [count] => 1 [0] => 1999 [min] => 648 [max] => 648 ) [sumsqr] => 419904 ) Array ( [sum] => 448 Array ( [count] => 1 [0] => 2007 [min] => 448 [max] => 448 ) [sumsqr] => 200704 ) Array ( [sum] => 464 Array ( [count] => 2 [0] => 2010 [min] => 192 [max] => 272 ) [sumsqr] => 110848 )
  • 196. Group Level 2 :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/releases'); $client->setParameterGet('group_level', 2); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 197. Group Level 2 key value Array ( Array ( [sum] => 648 [0] => 1999 [count] => 1 [min] => 648 [1] => 10 [max] => 648 ) ) [sumsqr] => 419904 Array ( Array ( [sum] => 448 [0] => 2007 [count] => 1 [min] => 448 [1] => 05 [max] => 448 ) ) [sumsqr] => 200704 Array ( Array ( [sum] => 464 [0] => 2010 [count] => 2 [min] => 192 [1] => 01 [max] => 272 ) ) [sumsqr] => 110848
  • 199. Including Docs :05 $db = 'http://127.0.0.1:5984/books'; $client = new Zend_Http_Client(); $client->setUri($db . '/_design/default/_view/titles'); $client->setParameterGet('reduce', 'false'); $client->setParameterGet('include_docs', 'true'); $client->setHeaders('Accept', 'application/json'); $response = $client->request(Zend_Http_Client::GET); $body = $response->getBody(); $results = Zend_Json::decode($body); print_r($results);
  • 200. Including Docs id key value doc Array ( "Building iPhone Apps [_id] => 978-0-596-80579-1 "978-0-596-80579-1" with HTML, CSS, and 192 [_rev] => 1-09ce09fef75068834da99957c7b14cf2 JavaScript" … ) Array ( "CouchDB: The [_id] => 978-0-596-15589-6 "978-0-596-15589-6" 272 [_rev] => 2-099d205cbb59d989700ad7692cbb3e66 Definitive Guide" … ) Array ( "DocBook: The [_id] => 978-1-565-92580-9 "978-1-565-92580-9" 648 [_rev] => 1-b945cb4799a1ccdd1689eae0e44124f1 Definitive Guide" … ) Array ( [_id] => 978-0-596-52926-0 "978-0-596-52926-0" "RESTful Web Services" 448 [_rev] => 2-de467b329baf6259e791b830cc950ece … )
  • 202. Multi-Master Replication • peer-based and bi-directional • no explicit cluster setup required • synchronization is incremental • changes feed allows for replication to other systems
  • 203. Couchbase Mobile[1] for iOS and Android 1. http://www.couchbase.com/products-and-services/couchbase-mobile
  • 204. Horizontally Scalable • shared nothing architecture • non-blocking reads and writes for high concurrency • fault tolerant, isolated messages
  • 205. ACID Compliant Atomicity: individual document updates are “all or nothing” Consistency: queries will be “point in time” consistent Isolation: updates isolated to document revision number Durability: success code is returned only after data is on disk
  • 206. Authentication • special _users database • basic access authentication • cookie authentication • OAuth support
  • 207. Security Model • server admins • database admins • database readers • document-level authorization with validation functions
  • 208. Web Server • static les as attachments (e.g. HTML, Javascript, CSS) • URL rewriting • HTTP proxying • HTTP range requests • SSL support • virtual hosts
  • 209. Application Server • show functions • list functions • document update handlers
  • 211. Clustering • Lounge[1] • Pillow[2] • BigCouch[3] 1. http://tilgovi.github.com/couchdb-lounge/ 2. https://github.com/khellan/Pillow 3. https://github.com/cloudant/bigcouch
  • 212. Extensible • GeoCouch[1] for geospatial indexing • couchdb-lucene[2] for full text indexing • ElasticSearch[3] for full text indexing 1. https://github.com/couchbase/geocouch 2. https://github.com/rnewson/couchdb-lucene 3. http://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration.html
  • 214. Hosting Iris Couch • Free (for now) • Couchbase server • GeoCouch geospatial indexing • http://www.iriscouch.com Cloudant • Various pricing levels • Full-text searching • Ad-hoc queries • Elastic scaling, clustering and sharding using BigCouch • https://cloudant.com
  • 215. Documentation and Books CouchDB Wiki Scaling CouchDB http://wiki.apache.org/couchdb/ by Bradley Holt (O’Reilly) 978-1-4493-0343-3 CouchDB: The De nitive Guide by J. Chris Anderson, Jan Getting Started with CouchDB Lehnardt and Noah Slater by MC Brown (O’Reilly) (O’Reilly) 978-1-4493-0755-4 978-0-596-15589-6 Beginning CouchDB Writing and Querying MapReduce by Joe Lennon (Apress) Views in CouchDB 978-1-430-27237-3 by Bradley Holt (O’Reilly) 978-1-449-30312-9
  • 216. http://oreilly.com/catalog/9781449303129/ http://oreilly.com/catalog/9781449303433/
  • 218. Thank You @BradleyHolt http://bradley-holt.com bradley.holt@foundline.com Copyright © 2011 Bradley Holt. All rights reserved.

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
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. CAP: Consistency, Availability and Partition Tolerance\n
  25. CAP: Consistency, Availability and Partition Tolerance\n
  26. CAP: Consistency, Availability and Partition Tolerance\n
  27. CAP: Consistency, Availability and Partition Tolerance\n
  28. CAP: Consistency, Availability and Partition Tolerance\n
  29. CAP: Consistency, Availability and Partition Tolerance\n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. similar to materialized views\n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. Response headers will be truncated from here on.\n
  136. Response headers will be truncated from here on.\n
  137. Response headers will be truncated from here on.\n
  138. \n
  139. \n
  140. \n
  141. \n
  142. \n
  143. \n
  144. \n
  145. \n
  146. \n
  147. \n
  148. \n
  149. \n
  150. \n
  151. \n
  152. \n
  153. Response headers will be truncated from here on.\n
  154. Response headers will be truncated from here on.\n
  155. Response headers will be truncated from here on.\n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n
  161. \n
  162. \n
  163. \n
  164. \n
  165. \n
  166. \n
  167. \n
  168. \n
  169. \n
  170. \n
  171. \n
  172. \n
  173. \n
  174. \n
  175. \n
  176. \n
  177. Get all authors, reduced.\n
  178. \n
  179. Get all authors, not reduced.\n
  180. \n
  181. \n
  182. Get books in “Print” format.\n
  183. \n
  184. Get author names beginning with the letter “j”.\n
  185. \n
  186. \n
  187. Get only five book formats.\n
  188. \n
  189. Skip the first five formats.\n
  190. \n
  191. \n
  192. \n
  193. Get the next page of results.\n
  194. \n
  195. Get book titles in descending order.\n
  196. \n
  197. \n
  198. Get books formats, grouped by format.\n
  199. \n
  200. \n
  201. \n
  202. \n
  203. Get books by release date.\n
  204. \n
  205. Get books by year released.\n
  206. \n
  207. Get books by year and month released.\n
  208. \n
  209. \n
  210. Get books by release date.\n
  211. \n
  212. \n
  213. \n
  214. J. Chris Anderson will be doing a talk on Couchbase Mobile on Wednesday at 2:45pm in Room 203.\n
  215. \n
  216. \n
  217. \n
  218. \n
  219. \n
  220. \n
  221. \n
  222. \n
  223. \n
  224. \n
  225. \n
  226. \n
  227. \n
  228. \n
  229. \n