I'm trying to call update functions from MyCouch. The documentation of Mycouch reports only an outdated example with Post method on _design
documents.
But how to consume an Update function
{
"_id": "_design/artists",
"language": "javascript",
"views": {
"albums": {
"map": "function(doc) { if(doc.$doctype !== 'artist') return; emit(doc.name, doc.albums);}"
}
}
};
client.Documents.Post(designDocumentAsJson);
How to execute the update function on _design couchDB pushing a new document ?
The couchDB documentation tells about this call
PUT /{db}/_design/{ddoc}/_update/{func}/{docid}
PUT /{db}/_design/{ddoc}/_update/{func}/{docid}
You can insert Design document like below to db: https://docs.couchdb.org/en/stable/api/ddoc/render.html#db-design-design-doc-update-update-name
function (Without stringifying):
Example doc:
After Api
Request:
Response:
doc after updating