Last active
March 23, 2021 16:33
-
-
Save paldepind/7211654 to your computer and use it in GitHub Desktop.
Delete all documents returned by a view in CouchDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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