incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: view - first 50 with favorite rating or first 50
Date Thu, 05 May 2011 18:27:35 GMT
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
>

Mime
View raw message