CBLView totalRows private

7 views
Skip to first unread message

Brendan Duddridge

unread,
Jul 14, 2015, 4:08:26 PM7/14/15
to mobile-c...@googlegroups.com
Hi,

I see there's a CBLView totalRows property that gives the number of rows in a view. Is it possible to expose that to us? It would be much quicker to access that than to compute it in a reduce block since it's already there from the "total_docs" property in the views table.

Thanks,

Brendan

Jens Alfke

unread,
Jul 14, 2015, 5:07:19 PM7/14/15
to mobile-c...@googlegroups.com

On Jul 14, 2015, at 1:08 PM, Brendan Duddridge <bren...@gmail.com> wrote:

I see there's a CBLView totalRows property that gives the number of rows in a view. Is it possible to expose that to us?

That would make sense, especially since that info is already provided in the REST API (as the “total_rows” property in the JSON response to a view query.)

The question is, should it return the current total rows in the index (as it does today), or should it update the view index first (to reflect the current state of the database)? I lean toward the latter.

Anyway, please file an issue in Github.

—Jens

Brendan Duddridge

unread,
Jul 14, 2015, 5:42:38 PM7/14/15
to mobile-c...@googlegroups.com
Github Issue submitted.

But I think it should display whatever value is quickest to retrieve. I have a list of Forms that display the count of the number of records within them. I have one CBLView per Form. I wouldn't want it to have to compute the totalRows at the moment I fetched my list of forms. It's fine to update it if I click on a form, but not just to display the list of forms and their record counts.
Reply all
Reply to author
Forward
0 new messages