Permalink
Browse files

added removeDoc

  • Loading branch information...
1 parent 7d914e5 commit 9cba362f589f90d18a56367bd12a52e6b553fabb Nathan committed Nov 11, 2009
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/couchdb/database.js
View
@@ -57,6 +57,25 @@ Database = {
return saved;
},
+ /**
+ * Deletes a document from the database
+ * @param id Id of the document to remove
+ */
+ removeDoc: function(doc) {
+ var removed = false;
+
+ this.httpClient.del(this.uri + encodeURIComponent(doc._id) + "?rev=" + doc._rev, {
+ success: function(data, statusText) {
+ removed = true;
+ },
+ error: function(xhr) {
+ removed = false;
+ print("ERROR: " + xhr.status);
+ }
+ });
+
+ return removed;
+ },
/**
* Bulk save documents with the couchdb bulk save API
* @param {Object} docs Documents to save

0 comments on commit 9cba362

Please sign in to comment.