incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Groves" <adam.gro...@gmail.com>
Subject Re: View with incremental counter
Date Tue, 18 Nov 2008 12:48:51 GMT
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 <ulises.cervino@gmail.com>:
>> 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
>

Mime
View raw message