incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "armin weisser" <armin.weis...@virtual-identity.com>
Subject AW: total_rows:1 but rows:[]
Date Thu, 28 Apr 2011 10:26:25 GMT
> The built-in _count function is the fastest method.

Thanks. That helps!

-----Urspr√ľngliche Nachricht-----
Von: Robert Newson [mailto:robert.newson@gmail.com] 
Gesendet: Donnerstag, 28. April 2011 12:22
An: user@couchdb.apache.org
Betreff: Re: total_rows:1 but rows:[]

total_rows is the total number rows in the view, not the query. This often confuses people.

Yes, you'll need to use reduce to count the number of rows. The built-in _count function is
the fastest method.

B.

On 28 April 2011 11:13, armin weisser
<armin.weisser@virtual-identity.com> wrote:
>>> Do you mean "number of pages" (in terms of pagination) when you say "records".
>>> That would make sense. So we'd have 1 page but no documents to display.
>
>> when i say record, i normally mean record ;) in couchdb-speek it's a document.
> ;)
>
>
> Ok. I think I got it.
>
> So if I'm interested in the question "Are there any documents matching the key?" I have
to manually count the rows or use a reduce function.
>
> Thanks for your help.
>
> Cheers,
>
> Armin
>
>
> -----Urspr√ľngliche Nachricht-----
> Von: Stefan Matheis [mailto:matheis.stefan@googlemail.com]
> Gesendet: Donnerstag, 28. April 2011 12:03
> An: user@couchdb.apache.org
> Betreff: Re: total_rows:1 but rows:[]
>
> Armin,
>
> On Thu, Apr 28, 2011 at 11:53 AM, armin weisser <armin.weisser@virtual-identity.com>
wrote:
>> Do you mean "number of pages" (in terms of pagination) when you say "records".
>> That would make sense. So we'd have 1 page but no documents to display.
>
> when i say record, i normally mean record ;) in couchdb-speek it's a document.
>
> it's not directly related to pagination .. of course helpful to 
> calculate pages and so on, but in general it tells you only how many
> (possible) records/documents this view has. and this is (like said) the case when you
request the view without any parameters that would exclude some records/documents.
>
> Regards
> Stefan
>

Mime
View raw message