couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muji <>
Subject Re: Is pagination possible with multiple keys query?
Date Thu, 25 Oct 2012 17:26:35 GMT
My understanding is no it's not possible when using multiple keys to
query a view, but I would love to be corrected.

My use case was a tree-style taxonomy where I wanted to be able to
query a view to show all the items that belonged to a *parent* in the
taxonomy and then paginate those. But the restriction of startkey and
startkey_docid only enabling a single key prevented this option. I did
not want to use the *skip* style pagination because of the performance

My solution (which I am yet to fully implement) is to dynamically
create a view as the taxonomy is modified, so I will end up with a map
function for each non-leaf node of the tree:

			map: function( doc )
				if( doc.parent == 'bcd/jacket' && doc['equipment-type'] == 'item' )
					emit( doc.parent, null );

No doubt there is a better way, but I am yet to find it ;)

2012/10/25 Aliaksandr Barysiuk <>:
> Hello,
>, pagination chapter.
> Short answer: you can try to use startkey+ startkey_docid
> On 25/10/12 18:58, Dirkjan Ochtman wrote:
>> On Thu, Oct 25, 2012 at 5:54 PM, boazc <> wrote:
>>> Using "keys" with "startkey" is not possible, so I don't know how to tell
>>> couchdb to start from a given document of a given key (in my case of
>>> using
>>> "keys" parameter).
>> Please discuss this on the user list, not the dev list.
>> Cheers,
>> Dirkjan

mischa (aka muji).

View raw message