That's what I thought. The output is definitely sorted by key, but the document with a 'count' of one is in the middle of my results.
I just tried this view for debugging: count = 0; function(doc) { if(doc.type == "document") { count = count + 1 emit(doc._id, [count, doc.updated_at]); } } and it turns out that the document with a count of 1 is the most recently updated document. 2008/11/18 Ulises <[EMAIL PROTECTED]>: >> 62, 61, 22, 19. I'm not quite sure what's going on here - any ideas >> how the order is being set here? > > Aren't the rows ordered by doc._id in this case? AFAIK (key, value) > pairs are ordered by key so perhaps emit(count, doc._id) might be more > appropriate. > > I could be completely wrong here though :) > > U >