couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nils Breunese <N.Breun...@vpro.nl>
Subject RE: view - first 50 with favorite rating or first 50
Date Thu, 05 May 2011 18:35:45 GMT
Don't forget to also use ?descending=true or the favorites will come out last.

Nils.
________________________________________
Van: Robert Newson [robert.newson@gmail.com]
Verzonden: donderdag 5 mei 2011 20:27
Aan: user@couchdb.apache.org
Onderwerp: Re: view - first 50 with favorite rating or first 50

function(doc) {
  emit(doc.rating, null);
}

All strings sort after all numbers, so "favorite" will sort later than
any numerical rating.

query with ?limit=50 to cap the response.

B.

On 5 May 2011 19:21, bryan rasmussen <rasmussen.bryan@gmail.com> wrote:
> I am wondering how to do this:
>
> I have documents with a rating field, which can have the value
> "favorite". I want to return the first 50 favorites but if there are
> less than 50 favorites I want to return documents without favorite
> status until the count of 50 is reached - so if I can only find 40
> favorites then I have to return those 40 and then another 10
> non-favorites.
>
> Thanks,
> Bryan Rasmussen
>
------------------------------------------------------------------------
 VPRO   www.vpro.nl
------------------------------------------------------------------------

Mime
View raw message