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 <[email protected]>
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:[email protected]: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.
>

Reply via email to