Thanks Scott. I thought it was something else completely. Interestingly CouchDB v 2.0.0 rejected the curl command immediately but v 1.6.1 did not complain. However, upon opening Futon(1.6.1), the view was completely unusable, as one would expect. Credit to those who upgraded CouchDB to 2.0.0
On 19 July 2017 at 17:51, Scott Shattuck <scott.shatt...@gmail.com> wrote: > 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 < > johnlebrass...@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. > > > Thanks again. John