NoSQL Zone is brought to you in partnership with:

Bradley Holt is a web developer, entrepreneur, community facilitator, speaker, and an author. He is the co-founder of Found Line, a creative studio with capabilities in web development, web design, and print design. He is a Board Member at Vermont Community Access Media, a non-profit community media and technology center. He is a minor contributor of source code and bug reports to Zend Framework and an active member of the PHP community. He organizes the Burlington, Vermont PHP Users Group where he is a regular speaker and is involved with helping to organize other technology community events such as Vermont Code Camp. He has spoken at (or will be speaking at) SXSW Interactive, OSCON, OSCON Data, the jQuery Conference, and ZendCon. He is the author of Writing and Querying MapReduce Views in CouchDB and Scaling CouchDB, both published by O’Reilly Media. He blogs at and can be found on Twitter as @BradleyHolt. Bradley is a DZone MVB and is not an employee of DZone and has posted 17 posts at DZone. You can read more from them at their website. View Full User Profile

Writing and Querying MapReduce Views in CouchDB

  • submit to reddit
My first book, Writing and Querying MapReduce Views in CouchDB, was published by O’Reilly Media some time ago. It is a short and concise ebook with step-by-step instructions and lots of sample code. Most examples are provided both in Futon and using CouchDB’s RESTful HTTP API (using cURL).

In my experience, web developers who are new to CouchDB often encounter three main barriers to understanding and using CouchDB. First, its JSON documents. Second, its RESTful HTTP API. Third, its MapReduce views. The first two are fairly straightforward and many web developers already have experience with JSON and RESTful HTTP APIs. Once you understand the benefits of using JSON as a document format and exposing the database through a RESTful HTTP API, then understanding MapReduce views becomes the main barrier.

The goal of this book is to walk readers through both writing MapReduce views and then querying these same views. Both the Map and Reduce steps are explained separately. Several example Map functions are demonstrated and the built-in Reduce functions are covered. There are also discussions about custom Reduce functions and the limitations of MapReduce. There are examples of creating both temporary views and saving views permanently to design documents. Finally, there is a chapter on querying views which talks about range queries, limiting rows, skipping rows, reversing results, exact grouping, group levels, and including the original documents in query results.

P.S. If you are a blogger and would like to review this book, then please ping me and let me know.

 Indexing and Querying Documents

Published at DZone with permission of Bradley Holt, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)