Contents
Preface
IntroductionConventions Used in This BookUsing Code ExamplesSafari® Books OnlineHow to Contact UsAcknowledgements1. Why CouchDB?
Learning to RelaxA Different Data ModelReplicationEventual ConsistencyData: Local, Remote, EverywhereCouchDB Deployment and Peformance2. Installation
Installation on LinuxInstallation on Mac OS XUsing HomebrewUsing MacPortsInstallation on WindowsInstallation from SourceConfiguring and Building CouchDBRunning CouchDBNext Steps3. CouchDB Basics
Using FutonManaging Databases and DocumentsConfiguring ReplicationPopulating a Simple DatabaseCreating DatabasesCreating DocumentsUpdating DocumentsDeleting DocumentsDeleting DatabasesCommon OperationsHTTP OperationsErrorsHTTP HeadersRequest HeadersResponse HeadersHTTP URL PathsJSONDocumentsDocument StructureDocument TypesStructure and Consistency4. Design Documents
Creating Design DocumentsShowsViewsView BasicsQuerying a ViewQuerying on Complex DataQuerying Compound DataReduce FunctionsBuilt-in _countBuilt-in _sumBuilt-in _statsCustom reduce functionsError handling in viewsTemporary viewsQuerying View ResultsLists
Chapter 3. CouchDB Basics
Before you start using the CouchDB API, you need to think about the basic processes of accessing the CouchDB server, and how you perform the basic commands and operations that make up your interaction.
For this chapter, we are going to concern ourselves with the basic layout, structure, and how to communicate and exchange the basic information to and from the server.
On that note, it is worth restating that CouchDB works entirely through the HTTP-based CouchDB REST API. That means that if you have an application or environment that can talk HTTP (and many can), you can communicate through the CouchDB API. The interaction is entirely based around the HTTP protocol and the path and data that you supply, either as part of the URL specification or as HTTP payload data.
In this context, HTTP is ideally suited to the database interactions because it supports many of the same basic operations in a database (Create, Retrieve, Update, and Delete) and can be directly mapped to the HTTP protocol operations of PUT, GET, POST, and DELETE.
The URL component of the HTTP request is important within CouchDB in that it is used to identify individual components (databases, documents, other components) within CouchDB. More on this later in the chapter.
Looking at everything without seeing it in action would be difficult, so let’s look at some basic interactions that you might typically perform with your CouchDB database.
Using Futon
Futon is a native web-based interface built into ...
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.
Read now
Unlock full access