Skip to content

Instantly share code, notes, and snippets.

@paldepind
Last active March 23, 2021 16:33
Show Gist options
  • Save paldepind/7211654 to your computer and use it in GitHub Desktop.
Save paldepind/7211654 to your computer and use it in GitHub Desktop.
Delete all documents returned by a view in CouchDB
var couchUrl = "foobar";
$.getJSON(couch-url + "view-name-here", function(data) {
data.rows.forEach(function (doc) {
$.ajax({
url: couch-url + doc.value._id + '?rev=' + doc.value._rev,
type: 'DELETE',
success: function(result) {
console.log("Deleted document with id " + doc.value._id);
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment