You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Michal Nowikowski <go...@gmail.com> on 2010/01/06 08:37:09 UTC

retrieving particular documents in one shot

Hello,

I digging in manuals but cannot find the answer. Is it possible to
retrieve in one view query a list of particular documents.
I'd like to pass a list of keys and retrieve contents of these
documents. I cannot use range of keys using startkey and endkey.
I need to indicate specific documents, something like that:
    key='a'&key='g'&key='t'
while in db there are documents with keys from 'a' to 'z'.
I need such approach because the documents are too huge to retrieve
them all at once and I also do not want to retrieve them one by one.
Is it possible in CouchDB?

Thanks in advance
Michał Nowikowski

Re: retrieving particular documents in one shot

Posted by Adam Kocoloski <ko...@apache.org>.
Hi Oliver, GET requests with bodies aren't always supported, and including the keys in the URL bumps into length limitations in many pieces of HTTP infra.  With that said, I'm not opposed to an alternative that uses GET.  The POST version has to stick around, though.  Cheers,

Adam

On Jan 8, 2010, at 11:59 AM, Oliver Oli wrote:

> Why POST and not GET?
> 
> 2010/1/6 Alex Koshelev <da...@gmail.com>:
>> Hi, Michal!
>> 
>> If you want to get set of keys from view[1] or database[2] you can make POST
>> request with body consits of needed keys -- for your example:
>> 
>>  {'keys': ['a', 'g', 't']}
>> 
>> 
>> [1]: http://wiki.apache.org/couchdb/HTTP_view_API
>> [2]: http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API
>> ---
>> Alex Koshelev
>> 
>> 
>> On Wed, Jan 6, 2010 at 10:37 AM, Michal Nowikowski <go...@gmail.com>wrote:
>> 
>>> Hello,
>>> 
>>> I digging in manuals but cannot find the answer. Is it possible to
>>> retrieve in one view query a list of particular documents.
>>> I'd like to pass a list of keys and retrieve contents of these
>>> documents. I cannot use range of keys using startkey and endkey.
>>> I need to indicate specific documents, something like that:
>>>    key='a'&key='g'&key='t'
>>> while in db there are documents with keys from 'a' to 'z'.
>>> I need such approach because the documents are too huge to retrieve
>>> them all at once and I also do not want to retrieve them one by one.
>>> Is it possible in CouchDB?
>>> 
>>> Thanks in advance
>>> Michał Nowikowski
>>> 
>> 


Re: retrieving particular documents in one shot

Posted by Oliver Oli <ol...@gmail.com>.
Why POST and not GET?

2010/1/6 Alex Koshelev <da...@gmail.com>:
> Hi, Michal!
>
> If you want to get set of keys from view[1] or database[2] you can make POST
> request with body consits of needed keys -- for your example:
>
>  {'keys': ['a', 'g', 't']}
>
>
> [1]: http://wiki.apache.org/couchdb/HTTP_view_API
> [2]: http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API
> ---
> Alex Koshelev
>
>
> On Wed, Jan 6, 2010 at 10:37 AM, Michal Nowikowski <go...@gmail.com>wrote:
>
>> Hello,
>>
>> I digging in manuals but cannot find the answer. Is it possible to
>> retrieve in one view query a list of particular documents.
>> I'd like to pass a list of keys and retrieve contents of these
>> documents. I cannot use range of keys using startkey and endkey.
>> I need to indicate specific documents, something like that:
>>    key='a'&key='g'&key='t'
>> while in db there are documents with keys from 'a' to 'z'.
>> I need such approach because the documents are too huge to retrieve
>> them all at once and I also do not want to retrieve them one by one.
>> Is it possible in CouchDB?
>>
>> Thanks in advance
>> Michał Nowikowski
>>
>

Re: retrieving particular documents in one shot

Posted by Alex Koshelev <da...@gmail.com>.
Hi, Michal!

If you want to get set of keys from view[1] or database[2] you can make POST
request with body consits of needed keys -- for your example:

 {'keys': ['a', 'g', 't']}


[1]: http://wiki.apache.org/couchdb/HTTP_view_API
[2]: http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API
---
Alex Koshelev


On Wed, Jan 6, 2010 at 10:37 AM, Michal Nowikowski <go...@gmail.com>wrote:

> Hello,
>
> I digging in manuals but cannot find the answer. Is it possible to
> retrieve in one view query a list of particular documents.
> I'd like to pass a list of keys and retrieve contents of these
> documents. I cannot use range of keys using startkey and endkey.
> I need to indicate specific documents, something like that:
>    key='a'&key='g'&key='t'
> while in db there are documents with keys from 'a' to 'z'.
> I need such approach because the documents are too huge to retrieve
> them all at once and I also do not want to retrieve them one by one.
> Is it possible in CouchDB?
>
> Thanks in advance
> Michał Nowikowski
>