couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Forno <fabio.fo...@gmail.com>
Subject Re: counting rows in range queries
Date Thu, 30 Jul 2009 08:58:23 GMT
On Thu, Jul 30, 2009 at 9:58 AM, Brian Candler<B.Candler@pobox.com> wrote:
> On Thu, Jul 30, 2009 at 02:38:15AM +0200, Fabio Forno wrote:
>> Now the difficult part. There are many consumers who retrieve the
>> items from the buckets and each consumers knows the date of the last
>> item it has retrieved, so I do a range query on the view with
>> startkey=[item.bucket, last_date], endkey=[item.bucket, stopper]. This
>> is fine, but if I want to tell the user how many items it has to
>> retrieve before actually downloading them I can't do nothing but
>> retrieving all the rows and start counting.
>
> I'm not sure I have understood the problem correctly, because:
>
> (1) if you do a view fetch with limit=0 in the query string, you'll get
> the count without the documents.
>

In that case all I get is an empty row set in reduce views, and the
total number of rows in the view, not the selection, while doing map
views. However what you say is exactly what I'd like to have: when I
write limit=0 I want couchdb to do a count for me, otherwise limit=0
would be meaningless (instead with all the other limits or no limit
the normal couchdb behavior is good)

bye

-- 
Fabio Forno, Ph.D.
Bluendo srl http://www.bluendo.com
jabber id: ff@jabber.bluendo.com

Mime
View raw message