Skip to content

Instantly share code, notes, and snippets.

@ingoradatz
Forked from DoomyTheFroomy/removeDocsFromCouchdb.js
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ingoradatz/f47cea14fbefd40f7319 to your computer and use it in GitHub Desktop.
Save ingoradatz/f47cea14fbefd40f7319 to your computer and use it in GitHub Desktop.
var targetDB = 'db';
var blacklist = ['_design/']
$.couch.db(targetDB).allDocs({'success':function(all_docs){
for (var i = 0; i < all_docs.rows.length; ++i) {
var docId = all_docs.rows[i].id;
if (blacklist.indexOf(docID) === -1) {
$.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