couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Re: Inconsistencies (?) when querying reduce views
Date Thu, 10 Sep 2009 17:26:53 GMT
On Thu, Sep 10, 2009 at 12:58 PM, Brian Candler<> wrote:
> I've noticed a couple of possible inconsistences in querying a reduce view,
> which I thought I'd raise here rather than in JIRA for now.
> I am comparing querying a reduce view with a single key in the URL, versus
> querying it with a single key in a POST fetch. That is,
> GET /db/_design/ddoc/_view/vname?key=%22abc%22
> vs.
> POST /db/_design/ddoc/_view/vname
> {keys:["abc"]}
> (1) If you perform a multi-key fetch as above, it is refused with
> "query_parse_error", "multi-key fetchs for reduce view must include
> `group=true`", until you add ?group=true to the URL. However you do not need
> to do this for the single-key case.
> (2) In the single key case, you get "key":null in the response row, whereas
> in the multi-key fetch you get "key":"abc" or whatever the actual key was.
> Apart from this, both give a response in the same format, i.e.
> {"rows":[
> {"key":null,"value":123}
> ]}
> Any comments on this? I would have thought that the two should work in the
> same way.
> Regards,
> Brian.

That is a bit of an awkward inconsistency.

What's going on is that ?key="foo" is internally equivalent to
?startkey="foo"&endkey="bar" When doing reduces with a start/end key
its calculating the single reduce value between those values.

Using the multi-key fetch we're trying to pull back a row for a given
key, if you don't have a ?group=true then there are no keys to look

Paul Davis

View raw message