O'Reilly logo
live online training icon Live Online training

CouchDB First Steps

Topic: Data
Jonathan Hall

NoSQL database CouchDB has been around for 15 years, but it’s experienced a recent surge in popularity due to the addition of some exciting new features, which help it fill a unique niche among databases. If you find yourself needing to replicate data between many devices (such as a mobile app and a central server), CouchDB is a good fit. Likewise, if you need a highly resilient database that can continue to operate, even during temporary network failures, CouchDB is a smart choice.

Expert Jonathan Hall takes you through the most important features of CouchDB that make it particularly suited to these and similar situations. Along the way, you’ll explore the CouchDB REST API to learn how to do basic create, read, update, and delete (CRUD) queries, as well as searching.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • What CouchDB is and what makes it unique
  • When you should choose CouchDB over a traditional relational database
  • When you should choose CouchDB over other NoSQL databases, such as MongoDB
  • How to use the CouchDB REST API

And you’ll be able to:

  • list text hereCreate, update, read, and delete (CRUD) documents in CouchDB via the REST API
  • Perform a search query against documents stored in CouchDB
  • Replicate databases between CouchDB instances

This training course is for you because...

  • You’re a programmer with SQL experience and want to learn more about NoSQL.
  • You’re building an app that needs to easily synchronize data between devices, such as between a mobile device and a server, or between two servers.

Prerequisites

  • A computer with curl and CouchDB 2.3 or 3.0 installed (If you’re unable to install curl, you can use reqbin.com/curl to perform curl requests from the browser.)
  • A basic understanding of REST APIs and JSON
  • Familiarity with the command line (curl in particular)

Recommended Preparation:

To take part in the optional course exercises, download and install the following:

Recommended follow-up:

About your instructor

  • Jonathan Hall is a member of the CouchDB project management committee and the author of Kivik, a popular CouchDB driver for the Go programming language. Jonathan works for Lana, a Spanish fintech startup, and has spent the last 15+ years doing various forms of backend server programming, usually from his home office.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

What makes CouchDB unique (35 minutes)

  • Presentation: Relational databases (SQL) versus NoSQL; basic CAP theorem; what makes CouchDB unique among NoSQL databases
  • Group discussion: Match DB system (SQL or NoSQL) to common business problems; match NoSQL system to common business problems
  • Q&A

Fundamentals of CouchDB’s REST API (20 minutes)

  • Presentation: HTTP verbs (all standard except COPY); HTTP status codes (all standard); Content-Types (mostly JSON, with a few exceptions)
  • Q&A

Break (5 minutes)

Databases in CouchDB (20 minutes)

  • Presentation: Creating an empty database; listing all databases; deleting a database
  • Hands-on exercise: Create, list, and delete a database
  • Q&A

Documents in CouchDB (20 minutes)

  • Presentation: The structure of a CouchDB document (_id, _rev, _attachments, and custom fields); creating a new empty document; fetching a document
  • Hands-on exercise: Create and retrieve an empty document
  • Q&A

CRUD in CouchDB (20 minutes)

  • Presentation: Updating an existing document; deleting a document; tombstones
  • Hands-on exercise: Create and update a document using curl; delete a document
  • Q&A

Break (5 minutes)

More advanced queries (30 minutes)

  • Presentation: Listing documents with _all_docs; searching for documents with the _find endpoint
  • Hands-on exercise: Practice some queries
  • Q&A

Overview of advanced topics for self-exploration (25 minutes)

  • Presentation: Fauxton web interface; CouchDB replication; design documents and MapReduce views; authentication and security
  • Q&A