Skip to Main Content
Getting Started with CouchDB
book

Getting Started with CouchDB

by MC Brown
January 2012
Beginner content levelBeginner
84 pages
1h 58m
English
O'Reilly Media, Inc.
Content preview from Getting Started with CouchDB

Chapter 4. Design Documents

In Chapter 3, we examined the basics of creating documents in a CouchDB database. Documents are where you store the data, but the only way to get the information back out from your documents is to know the document ID you used to store the document. There are a few different issues with the document structure that you may want to consider, such as enforcing document structure, handling document validation, and searching and querying the document data.

The key to all of these different types of information, and many others, is the design document. Aside from the core document storage, the design document is probably the most important component of your CouchDB database. Design documents contain all of the database logic about the document you are storing. Think of the design document as the glue that turns each of your documents into the format or structure that you need for your application.

The different components of your design document are written using JavaScript and they are executed within the CouchDB application. Because they are code, you can perform almost any action that would perform with JavaScript on an object. This means that you can select fields and components, perform test, reformat, calculate, and many other operations. This is useful as the different components of the design document work together to support the different formatting, indexing, and other procedures.

To be more specific, a design document provides the following:

Views

Views ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Scaling CouchDB

Scaling CouchDB

Bradley Holt
CouchDB: The Definitive Guide

CouchDB: The Definitive Guide

J. Chris Anderson, Jan Lehnardt, Noah Slater

Publisher Resources

ISBN: 9781449309589Errata Page