GTALUG Presentation on CouchDBPresentation Transcript
Who am I?
Myles Braithwaite
We Develop Websites
What is CouchDB?
Erlang
Apache CouchDB is a distributed, fault-tolerant and schema-
free document-oriented database accessible via a RESTful
HTTP/JSON API. Among other features, it provides robust,
incremental replication with bi-directional conflict detection
and resolution, and is queryable and indexable using a table-
oriented view engine with JavaScript acting as the default view
definition language.
Quote from http://couchdb.org/.
Document-Oriented
Database
• Each record is store as a document.
• Any number of fields of any length.
• Fields can also contain multiple pieces of
data.
REST
• Representational State Transfer
• The foundation of all Web Services
• SOAP,
• XML-RPC,
• and basic HTTP methods like:
• POST, GET, PUT, DELETE
RESTful HTTP Methods CRUD
POST Create, Update & Delete
GET Read
PUT Create & Replace
DELETE Delete
“Django may be built for the Web, but CouchDB is built of the
Web. I’ve never seen software that so completely embraces the
philosophies behind HTTP. CouchDB makes Django look old-
school in the same way that Django makes ASP look outdated.”
— Jacob Kaplan-Moss, Django Developer
What is JSON?
• JavaScript version of XML.
• A less dramatic/lightweight version of XML.
• Google and Yahoo are using it in there Web
Services.
$ curl 'http://127.0.0.1:5984/address_book/_view/
contacts/contact_list/'
{quot;total_rowsquot;:5,quot;offsetquot;:0,quot;rowsquot;:[
{quot;idquot;:quot;93a31f6756545d9d59ca53fba6f92fe0quot;,quot;keyquot;:quot;My
les Braithwaitequot;,quot;valuequot;:
{quot;_idquot;:quot;93a31f6756545d9d59ca53fba6f92fe0quot;,quot;_revquot;:quot;
3685624062quot;,quot;fnquot;:{quot;family-
namequot;:quot;Braithwaitequot;,quot;given-namequot;:quot;Mylesquot;},quot;emailquot;:
[{quot;valuequot;:quot;me@mylesbraithwaite.netquot;,quot;typequot;:quot;Person
alquot;},
{quot;valuequot;:quot;myles@monkeyinyoursoul.comquot;,quot;typequot;:quot;Work
quot;}],quot;orgquot;:{quot;organization-namequot;:quot;Monkey in your
Soulquot;}}}
...
Use Cases
What CouchDB should
not be used for!
• A relational database.
• A replacement for relational databases.
• An object-oriented database. Or more
specifically, meant to function as a seamless
persistence layer for an OO programming
language.