Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added removeDoc

  • Loading branch information...
commit 9cba362f589f90d18a56367bd12a52e6b553fabb 1 parent 7d914e5
Nathan authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/couchdb/database.js
View
19 lib/couchdb/database.js
@@ -58,6 +58,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
* @param {Boolean} shouldThrow Should throw an error if fail?
Please sign in to comment.
Something went wrong with that request. Please try again.