You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Dirkjan Ochtman <di...@ochtman.nl> on 2012/10/25 17:58:46 UTC

Re: Is pagination possible with multiple keys query?

On Thu, Oct 25, 2012 at 5:54 PM, boazc <bc...@gmail.com> 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

Re: Is pagination possible with multiple keys query?

Posted by muji <fr...@gmail.com>.
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
implications.

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:

bcd_jacket:
		{
			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 <a....@gmail.com>:
> Hello,
>
> http://guide.couchdb.org/editions/1/en/recipes.html, 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 <bc...@gmail.com> 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).

Re: Is pagination possible with multiple keys query?

Posted by Aliaksandr Barysiuk <a....@gmail.com>.
Hello,

http://guide.couchdb.org/editions/1/en/recipes.html, 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 <bc...@gmail.com> 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