couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Metson <>
Subject Re: Limiting views to special users
Date Tue, 29 Dec 2009 13:05:39 GMT
	I think I can help with one of your points...

On 28 Dec 2009, at 11:59, Joscha Feth wrote:

> * the results of the view seem to be cached, even though Math.random()
> may change at each invocation - is this something specific to the
> temporary views (I used this for testing) or is this the default
> behaviour?

That's by design, you calculate a view and store the result because  
potentially that calculation is very expensive/time consuming. When  
you add/delete documents and access the view you calculate a diff of  
the existing view and the changes (that's a grossly simplified view of  
how it works...). This means that maps with calls to random() and date  
type functions will not behave as you initially expect (I hit this  
when playing with dates, the solution I had was to pass the date in as  
a key arg).

I don't think you can force a reindex of the view from a query, you  
can use stale=ok to see an old version of the view while another  
process updates the view.

View raw message