0
votes

I am trying to get a view in couchdb to include design docs. I have done it in the past, but can not get it to work today.

In a past couchapp there is a file called options.json that contains the text:

{
  "include_design": "true"
}

This results in the design doc containing

"options": {
   "include_design": "true"
},

I added this to the new project, but still the design doc is not processed by my views. Is there something that I missed?


CouchDB 1.7.1

2
Did you try to add "options": { "include_design": "true" }, manually to a design doc and see what will happen?user3405291
@user3405291 I checked, it is in the design doc.ctrl-alt-delor

2 Answers

2
votes

According to this documentation, include_design option is a boolean.


I double-checked CouchDB to see how it saves Boolean values by adding a document to a sample database with a Boolean value for one of the keys:

$ cat doc--0000 
{"time":"2011", "address":"CT", "include":true}
$ curl -k -X PUT https://admin:**@192.168.1.106:6984/sample/doc--0000 -d @doc--0000 
{"ok":true,"id":"doc--0000","rev":"1-e269c17275e2d21ba9100cd65b304d70"}
$ curl -k -X GET https://admin:**@192.168.1.106:6984/sample/doc--0000 
{"_id":"doc--0000","_rev":"1-e269c17275e2d21ba9100cd65b304d70","time":"2011","address":"CT","include":true}

The double-check confirms that the Boolean values are saved as true NOT "true". I'm not sure, maybe that's the cause of the issue.

0
votes

@user3405291 is correct the problem is with the string "true" instead of boolean true. CouchDB doesn't save this. Your view is run on the server as a javascript script so you should write it like you write javascript anywhere.