Reputation: 53
I want update one field in a document. I created a new document:
And I would like to change the value of field name
from aaa
to test
. I copied a script from: wiki.apache.org/couchdb/Document_Update_Handlers
, and I created a new design document:
Next I created a URL:
localhost:5984/asd/_design/temp/_update/in-place-query/8d6257096bbb199a3757954c00000d0c?name=title&value=test
That should update my field. I instead saw the error:
"{"error":"TypeError","reason":"{[{<<\"message\">>,<<\"point is undefined\">>},\n {<<\"fileName\">>,<<\"../share/couchdb/server/main.js\">>},\n {<<\"lineNumber\">>,1500},\n {<<\"stack\">>,\n <<\"(\\\"_design/temp\\\",[object Array],[object Array])@../share/couchdb/server/main.js:1500\\n()@../share/couchdb/server/main.js:1562\\n@../share/couchdb/server/main.js:1573\\n\">>}]}"}"
Have you got any idea to repair it?
Upvotes: 1
Views: 2096
Reputation: 18585
Document updates require that you send the _rev
id which means that you must have read the document prior. So, all you do is set the value of whatever document object property then pass the pre-read document back to couch in a PUT w _rev
for updating.
Upvotes: 0