Finding your data with views #396

colin-jack opened this Issue Mar 27, 2011 · 7 comments

3 participants


This chapter is excellent but I would rethink this paragraph as you have not described group_level and the rest of the paragraph doesn't seem like it belongs here at the introduction to a new section:

"We use an array key here to support the group_level reduce query parameter. CouchDB’s views are stored in the B-tree file structure (which will be described in more detail later on). Because of the way B-trees are structured, we can cache the intermediate reduce results in the non-leaf nodes of the tree, so reduce queries can be computed along arbitrary key ranges in logarithmic time. See Figure 1, “Comments map function”."


The example and description starting from this text could do with a bit of work:

"In the blog app, we use group_level reduce queries to compute the count of comments both on a per-post and total basis, achieved by querying the same view index with different methods. With some array keys, and assuming each key has the value 1:"


Worth clarifying what happens when you use multiple startkey values?

"returns the total number of rows between the start and end key. So with startkey=["a","b"]&endkey="b" the result would equal 3."


I'm not sure how a reader coming to this book to get started learning couchdb is going to be able to interpret this, an example like this without explanation is just confusing. Figure 1 that follows doesnt help either:

"If you’d like to count rows without depending on the row value, you can switch on the rereduce parameter:

function(keys, values, rereduce) {
if (rereduce) {
return sum(values);
} else {
return "


Pseudocode is fine but showing and explaining the rereducecrelated changes to the reduce would be better:

"The reduce function effectively calculates 3 + 1 on query time and returns the desired result. Example 2, “The result is 4” shows some pseudocode that shows the last invocation of the reduce function with actual values."


I felt this chapter was a bit poor around what exactly rereduce was for so I googled and got to the Wiki which explained it clearly. I think that section could perhaps be used as the basis for your content:


Bingo, I have the same problem with the starting paragraph of ``The view to get comment..."
It looks out of line. At least to me, a newbie to couch, I couldn't relate it with the rest of the chapter.


Ok, so i'm not the only one who is lost on this section. While reading the EPUB version I bought, I thought there was a whole missing chapter there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment