You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Brian Candler <B....@pobox.com> on 2009/04/20 15:39:08 UTC

reduce=true ?

Whilst couchdb accepts reduce=false for a map+reduce view, it appears to
reject reduce=true

$ curl http://127.0.0.1:5984/xxxxxxxx/_design/cf896d6c31207fc142eee585fac3b435/_view/friends?reduce=true
{"error":"query_parse_error","reason":"Bad URL parameter: reduce=true"}

Is this intentional?

It works fine if I omit the reduce parameter entirely (i.e. I get the
reduced value as expected). But the include_docs and group parameters do
accept both false and true.

The sample design doc:

$ curl http://127.0.0.1:5984/xxxxxxxx/_design/cf896d6c31207fc142eee585fac3b435
{"_id":"_design/cf896d6c31207fc142eee585fac3b435","_rev":"1-2028769355","language":"javascript","views":{"friends":{"reduce":"function(ks, vs, co) {\n  if (co) {\n    return sum(vs);\n  } else {\n    return vs.length;\n  }\n}\n","map":"function(doc) {\n  if (doc.friend) {\n    emit(doc.friend, null);\n  }\n}              \n"}}}

The server version:

$ curl http://127.0.0.1:5984/
{"couchdb":"Welcome","version":"0.9.0a766377"}

Regards,

Brian.

Re: reduce=true ?

Posted by Paul Davis <pa...@gmail.com>.
Brian,

Doh! Thanks for the heads up. I forgot that this function is called
twice for reduce views and the first time is before we know its a
reduce. I should have a patch in trunk shortly.

Paul

On Mon, Apr 20, 2009 at 9:56 AM, Brian Candler <B....@pobox.com> wrote:
> On Mon, Apr 20, 2009 at 02:39:08PM +0100, Brian Candler wrote:
>> $ curl http://127.0.0.1:5984/
>> {"couchdb":"Welcome","version":"0.9.0a766377"}
>
> Same with trunk compiled just now:
> {"couchdb":"Welcome","version":"0.9.0a766689"}
>

Re: reduce=true ?

Posted by Brian Candler <B....@pobox.com>.
On Mon, Apr 20, 2009 at 02:39:08PM +0100, Brian Candler wrote:
> $ curl http://127.0.0.1:5984/
> {"couchdb":"Welcome","version":"0.9.0a766377"}

Same with trunk compiled just now:
{"couchdb":"Welcome","version":"0.9.0a766689"}