These are the slides from my Ontario [GNU] Linux Fest 2009 talk on Apache CouchDB. You can download the PDF or see the Slideshare.
This is an example of a JSON document.
This is the same example as before but formated in XML.
JSON has the same basic data types as JavaScript.
Now you Friend has full control of the data on his instance of CouchDB.
You Fiends can replicate his changes back to you.
This can work on large scale distribution as while.
We are calling the PUT
method to our new database name.
And if everything is okay we will receive a 201 Created
response
and some JSON of {"ok":true}
.
If we try an create a database that already exists on the system we get a
412 Precondition Failed
.
We are calling the DELETE
method to out database to remove the
database from the CouchDB node.
And because the database exists we get back a 200 OK
response.
Using the GET
method...
We receive a JSON of all the documents in the Database and a 200 OK
response.
Here is the JSON in pretty print.
To create a document in the database we need to use the POST
method
and include some data...
We then get a 201 Created
response and a JSON document that contains
the id
and rev
(reversion) of the newly created document.
We use the GET
method and include the document id
...
and get back a response of 200 OK
and a JSON document. Note the HTTP
header Etag
, this is here so if you wanted to setup a proxy in front
of a cluster of CouchDB nodes.
This is the same JSON document as above in pretty print.
To update a document we use the method PUT
and include the current
document with our appended changes.
Notice the rev
has gone up by one.
couchdb-python, CouchKit, and CouchQuery.
If you are going to build your own library all you really need is your language's
HTTP module (httplib
, Net::HTTP
,
java.net.HttpUrlConnection
, and net/http
) and a third
party JSON dumper.
Mozilla Raindrop is an exciting new messaging platform developed
by the Thunderbird team. Not only does it use CouchDB as a database but also
uses the built in HTTP server for the client. Using a technique called CouchApp,
you can build HTML/JavaScript applications on top of your CouchDB database.
Ubuntu One is using CouchDB to store Contacts, Calendars, and
bookmarks on your computer. With the release of Karmic Kola CouchDB will be
installed by default on your computer.