incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darran White <darran.m.wh...@googlemail.com>
Subject Re: view request using keys: as content of request
Date Mon, 07 Jun 2010 06:35:53 GMT
Ah of course! I'll try that tonight. Thanks Zach.

Sent from my iPhone

On 6 Jun 2010, at 22:47, Zachary Zolton <zachary.zolton@gmail.com>
wrote:

> Daran,
>
> I think what you want to POST is:
>
> {"keys":[
> ["admin","d54561778b60a274a98c6e9bfd0100a2"]
> ]}
>
> Note the additional pair of square brackets.
>
>
> Cheers,
>
> Zach
>
> On Sunday, June 6, 2010, Darran White
> <darran.m.white@googlemail.com> wrote:
>> Hi,
>> I`m trying to request a view using as the content of the view
>> request where
>> the key is an array with a userName and a document id.
>>
>> I`m using POST to a view I`ve created with the URL
>> /cgmtest/_design/main/_view/getJobTaskByEmployeeAndJobId
>> The content of the view is
>> {"keys":["admin","d54561778b60a274a98c6e9bfd0100a2"]}
>>
>> However no documents are returned from the request.
>>
>> If I however just use a URL like
>> /cgmtest/_design/main/_view/getJobTaskByEmployeeAndJobId?key=
>> [%22admin%22,%22d54561778b60a274a98c6e9bfd0100a2%22]
>>
>> I do get a document returned.
>>
>> Does anyone know why the POST version doesn`t return a document?
>>
>> Heres the output from my logfile which shows the requests
>>
>> 21:51:36.398 [main] DEBUG o.a.h.i.c.DefaultClientConnection - Sending
>> request: POST /cgmtest/_design/main/_view/
>> getJobTaskByEmployeeAndJobId
>> HTTP/1.1
>> 21:51:36.401 [main] DEBUG org.apache.http.wire - >> "POST
>> /cgmtest/_design/main/_view/getJobTaskByEmployeeAndJobId HTTP/1.1
>> [EOL]"
>> 21:51:36.403 [main] DEBUG org.apache.http.wire - >> "Content-Type:
>> text/json[EOL]"
>> 21:51:36.405 [main] DEBUG org.apache.http.wire - >> "Content-Length:
>> 53[EOL]"
>> 21:51:36.407 [main] DEBUG org.apache.http.wire - >> "Host:
>> 127.0.0.1:5984
>> [EOL]"
>> 21:51:36.409 [main] DEBUG org.apache.http.wire - >> "Connection:
>> Keep-Alive[EOL]"
>> 21:51:36.410 [main] DEBUG org.apache.http.wire - >> "User-Agent:
>> Apache-HttpClient/4.0.1 (java 1.5)[EOL]"
>> 21:51:36.412 [main] DEBUG org.apache.http.wire - >> "Expect:
>> 100-Continue[EOL]"
>> 21:51:36.414 [main] DEBUG org.apache.http.wire - >> "[EOL]"
>> 21:51:36.415 [main] DEBUG org.apache.http.headers - >> POST
>> /cgmtest/_design/main/_view/getJobTaskByEmployeeAndJobId HTTP/1.1
>> 21:51:36.417 [main] DEBUG org.apache.http.headers - >> Content-Type:
>> text/json
>> 21:51:36.419 [main] DEBUG org.apache.http.headers - >> Content-
>> Length: 53
>> 21:51:36.420 [main] DEBUG org.apache.http.headers - >> Host:
>> 127.0.0.1:5984
>> 21:51:36.421 [main] DEBUG org.apache.http.headers - >> Connection:
>> Keep-Alive
>> 21:51:36.423 [main] DEBUG org.apache.http.headers - >> User-Agent:
>> Apache-HttpClient/4.0.1 (java 1.5)
>> 21:51:36.425 [main] DEBUG org.apache.http.headers - >> Expect: 100-
>> Continue
>> 21:51:36.431 [main] DEBUG org.apache.http.wire - << "HTTP/1.1 100
>> Continue[EOL]"
>> 21:51:36.433 [main] DEBUG org.apache.http.wire - << "[EOL]"
>> 21:51:36.434 [main] DEBUG o.a.h.i.c.DefaultClientConnection -
>> Receiving
>> response: HTTP/1.1 100 Continue
>> 21:51:36.436 [main] DEBUG org.apache.http.headers - << HTTP/1.1 100
>> Continue
>> 21:51:36.438 [main] DEBUG org.apache.http.wire - >>
>> "{"keys":["admin","d54561778b60a274a98c6e9bfd0100a2"]}"
>> 21:51:36.495 [main] DEBUG org.apache.http.wire - << "HTTP/1.1 200 OK
>> [EOL]"
>> 21:51:36.497 [main] DEBUG org.apache.http.wire - << "Server:
>> CouchDB/0.11.0
>> (Erlang OTP/R13B)[EOL]"
>> 21:51:36.498 [main] DEBUG org.apache.http.wire - << "Date: Sun, 06
>> Jun 2010
>> 20:51:36 GMT[EOL]"
>> 21:51:36.501 [main] DEBUG org.apache.http.wire - << "Content-Type:
>> text/plain;charset=utf-8[EOL]"
>> 21:51:36.503 [main] DEBUG org.apache.http.wire - << "Content-Length:
>> 38[EOL]"
>> 21:51:36.504 [main] DEBUG org.apache.http.wire - << "Cache-Control:
>> must-revalidate[EOL]"
>> 21:51:36.506 [main] DEBUG org.apache.http.wire - << "[EOL]"
>> 21:51:36.507 [main] DEBUG o.a.h.i.c.DefaultClientConnection -
>> Receiving
>> response: HTTP/1.1 200 OK
>> 21:51:36.509 [main] DEBUG org.apache.http.headers - << HTTP/1.1 200
>> OK
>> 21:51:36.511 [main] DEBUG org.apache.http.headers - << Server:
>> CouchDB/0.11.0 (Erlang OTP/R13B)
>> 21:51:36.512 [main] DEBUG org.apache.http.headers - << Date: Sun,
>> 06 Jun
>> 2010 20:51:36 GMT
>> 21:51:36.514 [main] DEBUG org.apache.http.headers - << Content-Type:
>> text/plain;charset=utf-8
>> 21:51:36.516 [main] DEBUG org.apache.http.headers - << Content-
>> Length: 38
>> 21:51:36.517 [main] DEBUG org.apache.http.headers - << Cache-Control:
>> must-revalidate
>> 21:51:36.519 [main] DEBUG o.a.h.i.client.DefaultHttpClient -
>> Connection can
>> be kept alive indefinitely
>> 21:51:36.522 [main] DEBUG org.apache.http.wire - <<
>> "{"total_rows":4,"offset":0,"rows":[]}[\n]"
>> 21:51:36.524 [main] DEBUG o.a.h.i.c.SingleClientConnManager -
>> Releasing
>> connection
>> org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@2d3853
>> 21:51:36.526 [main] DEBUG c.j.c.CouchStringResponseHandler - Recieved
>> response:{"total_rows":4,"offset":0,"rows":[]}
>>
>> regards
>>
>> Darran
>>

Mime
View raw message