Skip to content

Instantly share code, notes, and snippets.

@pionize
Created April 17, 2017 10:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pionize/1065559d9877e17da9bc1166b6924f40 to your computer and use it in GitHub Desktop.
Promise All
db.allDocs({include_docs: true}).then(function (result) {
return Promise.all(result.rows.map(function (row) {
return db.remove(row.doc);
}));
}).then(function (arrayOfResults) {
// All docs have really been removed() now!
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment