Forked from ryankirkman/couchdb_delete_non_design_docs.js
Last active
August 29, 2015 14:11
-
-
Save danse/c63515ece4b11739e404 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 cradle = require('cradle'); | |
var connection = new cradle.Connection( | |
'https://user:password@host', | |
443 | |
); | |
var db = connection.database('database') | |
db.all({include_docs: true}, function(err, allDocs) { | |
if (err) { | |
console.log(err); | |
} else { | |
allDocs.forEach(function(doc) { | |
if (doc._id) { | |
if (doc._id.indexOf('__design') == -1) { | |
db.remove(doc._id, doc._rev, console.log); | |
} | |
} else { | |
console.log('doc: '+JSON.stringify(doc).slice(0, 100)); | |
} | |
}) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment