You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Sean Clark Hess <se...@gmail.com> on 2010/02/11 19:31:43 UTC
startKey doesn't work on _all_docs?
Hi, I need to run through every record in a database, and I want to do it in
chunks so ruby doesn't collapse and die when it runs out of memory.
As far as I know, to page data, you're supposed to send a query a "limit"
and "startKey" parameter, correct? It doesn't seem to work with _all_docs.
Does it only work with a view?
http://localhost:5984/dev_schedule/_all_docs?startKey=008baf50a9f9668eec9a58a67d1a5b72&endKey=009e42280d3e42c8d37a485462c38e74
The above always returns all the documents.
http://localhost:5984/dev_schedule/_all_docs?startKey=008baf50a9f9668eec9a58a67d1a5b72&limit=5
This above will return the first 5 docs in the database, instead of starting
at 008.
Re: startKey doesn't work on _all_docs?
Posted by Zachary Zolton <za...@gmail.com>.
Argh! Make that startkey with a small "k", just as Bob said...
On Thu, Feb 11, 2010 at 2:11 PM, Zachary Zolton
<za...@gmail.com> wrote:
> Sean,
>
> Also, remember that key, startkey and endkey expecting a JSON
> value—not just an ID.
>
> So, your original query should have been:
>
> http://localhost:5984/dev_schedule/_all_docs?startKey=%22008baf50a9f9668eec9a58a67d1a5b72%22&limit=5
>
> Since %22 is a query string encoded double quote.
>
>
> Cheers,
>
> Zach
>
> On Thu, Feb 11, 2010 at 1:54 PM, Robert Newson <ro...@gmail.com> wrote:
>> startkey not startKey, endkey not endKey.
>>
>> B.
>>
>> On Thu, Feb 11, 2010 at 6:31 PM, Sean Clark Hess <se...@gmail.com> wrote:
>>> Hi, I need to run through every record in a database, and I want to do it in
>>> chunks so ruby doesn't collapse and die when it runs out of memory.
>>>
>>> As far as I know, to page data, you're supposed to send a query a "limit"
>>> and "startKey" parameter, correct? It doesn't seem to work with _all_docs.
>>> Does it only work with a view?
>>>
>>> http://localhost:5984/dev_schedule/_all_docs?startKey=008baf50a9f9668eec9a58a67d1a5b72&endKey=009e42280d3e42c8d37a485462c38e74
>>>
>>> The above always returns all the documents.
>>>
>>> http://localhost:5984/dev_schedule/_all_docs?startKey=008baf50a9f9668eec9a58a67d1a5b72&limit=5
>>>
>>> This above will return the first 5 docs in the database, instead of starting
>>> at 008.
>>>
>>
>
Re: startKey doesn't work on _all_docs?
Posted by Zachary Zolton <za...@gmail.com>.
Sean,
Also, remember that key, startkey and endkey expecting a JSON
value—not just an ID.
So, your original query should have been:
http://localhost:5984/dev_schedule/_all_docs?startKey=%22008baf50a9f9668eec9a58a67d1a5b72%22&limit=5
Since %22 is a query string encoded double quote.
Cheers,
Zach
On Thu, Feb 11, 2010 at 1:54 PM, Robert Newson <ro...@gmail.com> wrote:
> startkey not startKey, endkey not endKey.
>
> B.
>
> On Thu, Feb 11, 2010 at 6:31 PM, Sean Clark Hess <se...@gmail.com> wrote:
>> Hi, I need to run through every record in a database, and I want to do it in
>> chunks so ruby doesn't collapse and die when it runs out of memory.
>>
>> As far as I know, to page data, you're supposed to send a query a "limit"
>> and "startKey" parameter, correct? It doesn't seem to work with _all_docs.
>> Does it only work with a view?
>>
>> http://localhost:5984/dev_schedule/_all_docs?startKey=008baf50a9f9668eec9a58a67d1a5b72&endKey=009e42280d3e42c8d37a485462c38e74
>>
>> The above always returns all the documents.
>>
>> http://localhost:5984/dev_schedule/_all_docs?startKey=008baf50a9f9668eec9a58a67d1a5b72&limit=5
>>
>> This above will return the first 5 docs in the database, instead of starting
>> at 008.
>>
>
Re: startKey doesn't work on _all_docs?
Posted by Robert Newson <ro...@gmail.com>.
startkey not startKey, endkey not endKey.
B.
On Thu, Feb 11, 2010 at 6:31 PM, Sean Clark Hess <se...@gmail.com> wrote:
> Hi, I need to run through every record in a database, and I want to do it in
> chunks so ruby doesn't collapse and die when it runs out of memory.
>
> As far as I know, to page data, you're supposed to send a query a "limit"
> and "startKey" parameter, correct? It doesn't seem to work with _all_docs.
> Does it only work with a view?
>
> http://localhost:5984/dev_schedule/_all_docs?startKey=008baf50a9f9668eec9a58a67d1a5b72&endKey=009e42280d3e42c8d37a485462c38e74
>
> The above always returns all the documents.
>
> http://localhost:5984/dev_schedule/_all_docs?startKey=008baf50a9f9668eec9a58a67d1a5b72&limit=5
>
> This above will return the first 5 docs in the database, instead of starting
> at 008.
>