O'Reilly logo

CoffeeScript Application Development Cookbook by Mike Hatfield

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with CouchDB

CouchDB is an open source Apache project and, like MongoDB, is a no-SQL, document database.

In this section, we will see how to use CoffeeScript to perform create, read, update, and delete actions with a CouchDB database.

You can find more information on CouchDB, including information on downloading, installing, and using CouchDB from the project's home page located at http://couchdb.apache.org/.

Opening a connection

We will use the cradle NPM package to connect to our CouchDB server. In this example, we will open a connection and verify the existence of a database and, if it does not exist, we will create it.

Getting ready...

Once CouchDB has been installed, install cradle with the following command:

npm install cradle --save ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required