couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carl Bourne <carl.bou...@me.com>
Subject Re: Summary view for Pie Charting
Date Thu, 20 Sep 2012 07:04:05 GMT
Jens,

Understand! 

So I guess then the only way to do this is using 3 separate queries with startkey, endkey
for each time period? Then assemble the results externally using whatever performed the query?

Are there any other options?

Regards,

Carl


On 20 Sep 2012, at 01:18, Jens Alfke <jens@couchbase.com> wrote:

> This isn’t a valid map function, because it’s not purely functional — it uses external
input in the form of the current date/time. So if the map function is run twice on the same
document, it will not always emit the same output. That’s not allowed.
> 
> In other words, think of what happens if you generate the index now, and then query it
90 days from now. The information in the index probably won’t be valid because everything
will have expired already, right? But CouchDB has no idea the index is time-sensitive, so
it’s going to return you the old data anyway. You just cannot put time-sensitive data into
a map function.
> 
> Instead what you should be doing in the map is writing out the expiration times of the
documents. Then at query time you can see how far in the future those are.
> 
> —Jens


Mime
View raw message