diff options
author | Jan Lehnardt <jan@apache.org> | 2008-07-06 18:52:56 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2008-07-06 18:52:56 +0000 |
commit | c48e8ef02d8ba7a93dbb3e72c7be3441cb6bacbf (patch) | |
tree | 4500417f298159aaa03395be13d68d945cddb0d6 /share/www/script/couch.js | |
parent | c6478386af0bce72be0910b541f8fd4ee5b9455f (diff) |
Add RESTful API for document attachments as per http://groups.google.com/group/couchdb/browse_thread/thread/c84c5f35afb5db2a with not yet comprehensive tests.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@674334 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/couch.js')
-rw-r--r-- | share/www/script/couch.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js index 861fd070..38c9cf34 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -80,6 +80,16 @@ function CouchDB(name) { return result; } + // Deletes an attachment from a document + this.deleteDocAttachment = function(doc, attachment_name) { + var req = request("DELETE", this.uri + encodeURIComponent(doc._id) + "/" + attachment_name + "?rev=" + doc._rev); + var result = JSON.parse(req.responseText); + if (req.status != 200) + throw result; + doc._rev = result.rev; //record rev in input document + return result; + } + this.bulkSave = function(docs, options) { var req = request("POST", this.uri + "_bulk_docs" + encodeOptions(options), { body: JSON.stringify({"docs": docs}) |