couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Shattuck <scott.shatt...@gmail.com>
Subject Re: CouchDB 2.0.0: '{"error":"invalid_design_doc","reason":"`views.reduce` field must have object type"}
Date Wed, 19 Jul 2017 15:51:26 GMT
It looks to me like there's an extra '}' after the map function string and
before the reduce function string value. This would seem to be consistent
with the "views.reduce" message which implies the reduce isn't part of the
test: {} object but instead is one level too high.


ss


On Wed, Jul 19, 2017 at 9:30 AM, John Le Brasseur <johnlebrasseur@gmail.com>
wrote:

> Hi
> The command below works for CouchDB 1.6.1 but not for 2.0.0.
> I saw it mentioned on the Cloudant website but couldn't see an explanation.
> Could someone give me the reason or solution please:
>
> curl -X PUT http://user:pwd@127.0.0.1:5984/database/_design/abc
> -d'{"views":{"test":{"map":"function(doc){\n
> emit(doc.key,doc.value);\n}"},"reduce":"function(key,values){\n return
> count(values)\n;}"}, "language": "javascript"}' -H
> "Content-Type:application/json"
>
> reply:
> {"error":"invalid_design_doc","reason":"`views.reduce` field must have
> object type"}
>
> Many thanks.
>
> John.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message