Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Rookie Mistake 2: Async Loop
// I want to remove() all docs
db.allDocs({include_docs: true}).then(function (result) {
result.rows.forEach(function (row) {
db.remove(row.doc);
});
}).then(function () {
// I believe all docs have been removed()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment