[ 
https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12927868#action_12927868
 ] 

Adam Kocoloski commented on COUCHDB-523:
----------------------------------------

I've been thinking about this issue a bit and would like to propose an 
alternative syntax.  Instead of relying on overloading the "keys" field with 
things that are not really view keys, we could allow a new field called 
"queries" that looks like

{"queries":[{"key":"foo"}, {"startkey":"bar", "endkey":"baz", "limit":10}, ...]}

That is, each element of the queries Array would be a JSON Object specifying 
view query parameters.  Any parameters specified in the actual query string 
would be included as defaults.  CouchDB would execute the view requests 
serially and respond with an Array of view responses

[
  {"total_rows":100, "offset":34, "rows":[...]},
  {"total_rows":100, "offset":20, "rows":[...]}
]

The "keys" field and the "queries" field would be mutually exclusive.  The 
Objects in the queries Array would allow a user to specify any query-string 
parameter used with CouchDB views.  I'm not sure if _list functions would be 
supported.

This feature is really a crutch to help HTTP clients that cannot avail 
themselves of advanced HTTP features such as pipelining.  I'm happy to add it, 
though, as that the set of clients which do support pipelining is not that 
large.

What do you think?


> View API POST keys to retrieve multiple docs by key could also allow for 
> multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } 
> params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Assignee: Adam Kocoloski
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, 
> ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple 
> ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", 
> "endkey":"z" } ] }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to