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 01:16:17 GMT
On Thu, Jul 30, 2009 at 2:48 AM, Paul Davis<paul.joseph.davis@gmail.com> wrote:
>
>
> Does this not work?
>
> //map
> function(doc)
> {
>    emit(doc.bucket, doc.date);
> }
>
> //reduce
> function(keys, values, rereduce)
> {
>    if(rereduce) return sum(values);
>    return values.length;
> }
>
> // Number of rows
> http://127.0.0.1:5984/db_name/_design/foo/_view/bar?startkey=[bucket,last_date_seen]&endkey=[bucket,blocker]
>
> // Actual rows
> http://127.0.0.1:5984/db_name/_design/foo/_view/bar?startkey=[bucket,last_date_seen]&endkey[bucket,blocker]&reduce=false
>
> Or am I missing something?

Perhaps I don't understand something in the map/reduce, but how can I
define a range using the date if I emit just the bucket as key? In
that way I count just the total number of items in the bucket, don't
I?

bye

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

Mime
View raw message