pouchdb-find - how get total number of items that pass selector

356 views
Skip to first unread message

Roman Viskin

unread,
May 23, 2015, 6:55:57 AM5/23/15
to pou...@googlegroups.com
There are different approaches to get total number of items throughout PouchDB APIs.
When calling db.allDocs() one can find out total number of items with total_rows.
When calling db.query() with mapreduce and a view, _count reduction can be used.
But how do I get total number of items when calling db.find() of beta pouchdb-find API?
In my case, I want to use some selector, implement paging with 'limit' and 'skip' options, and with another call to retrieve the number of items that pass the selector, so I can implement paging navigation.

Roman Viskin

unread,
May 23, 2015, 3:41:08 PM5/23/15
to pou...@googlegroups.com
If somebody except me uses Kendo UI, I implemented an adapter between kendo find/sort syntax and pouchdb-find's one.
Here it it (starting from v.0.0.10): https://github.com/terikon/kendo-pouchdb. It enables cool kendo controls on top of PouchDB.
Documentation is still TODO, but in short it works in two modes - mapreduce and pouchdb-find. In mapreduce mode only limited set of filter/sorting combinations are supported for kendo's datasource, and in pouchdb-find mode everything that can be executed by db.find() is possible.
The only big thing that left to implement is to figure out the total number of items in pouchdb-find mode. And write documentation :)
Reply all
Reply to author
Forward
0 new messages