incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Metson <simonmet...@googlemail.com>
Subject Re: Multiple map reduce stages
Date Thu, 20 May 2010 10:25:22 GMT
Hi,

> I came up with the following solution. Grouping by value (uri) and  
> time
> using the group_level=1 and the start and end key like follow:
>
> /_temp_view? 
> group=true&group_level=1&startkey=[1270826004.0]&endkey=[{}, 
> 1270826011.0]
>
> and simply counting
>
> function(doc) { emit([doc.URI,doc.Time], 1 );

Shouldn't your start/end key also include the doc's URI? That way  
you'd only get the URI you are interested in for the date range that  
you specify. e.g. &startkey=[document1,  
1270826004.0]&endkey=[document1,1270826011.0]. If you switch the view  
around to emit [doc.Time, doc.URI] as the key you can find all URI's  
in the time range using &startkey=[1270826004.0,  
0]&endkey=[1270826011.0, {}].
Cheers
Simon

Mime
View raw message