OK, this answered to my question:

http://stackoverflow.com/questions/5571459/couchdb-view-query-with-multiple-key-values

It is never possible to query by criteria A and then sort by criteria B in 
CouchDB.

So I have to get posts in a data range, then sort them by number of hits myself.

-Filippo



On Jul 22, 2013, at 6:25 PM, Filippo Fadda wrote:

> Let's suppose I have a blog and I want display the popular posts, where 
> popular means: the 20 posts, of the last seven days, ordered by number of 
> hits.
> To avoid conflicts I don't save the number of hits in the post itself, but I 
> emit a new document every time a generic user displays a post.
> Even using view collation I don't get a solution for this problem.
> 
> -Filippo

Reply via email to