Skip to content

Instantly share code, notes, and snippets.

@StephanU
Last active December 10, 2015 19:48
Show Gist options
  • Save StephanU/4483528 to your computer and use it in GitHub Desktop.
Save StephanU/4483528 to your computer and use it in GitHub Desktop.
Remove docs from couchdb
var targetDB = "db";
$.couch.db(targetDB).allDocs({"success":function(docs){
for (var i = 0; i < docs.rows.length; ++i) {
var docId = docs.rows[i].id;
$.couch.db(targetDB).openDoc(docId, {"success":function(doc){
$.couch.db(targetDB).removeDoc(doc);
}});
}
}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment