Skip to content

Instantly share code, notes, and snippets.

@rnewson
Forked from manobi/bulk_delete.js
Last active August 29, 2015 13:57
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 rnewson/9427862 to your computer and use it in GitHub Desktop.
Save rnewson/9427862 to your computer and use it in GitHub Desktop.
var docs = [
{ _id: 'foo',
_rev: '1-70aa8fe77bbe596bded4a9de3aa185e4',
"foo": "bar"
},
{ _id: 'bar',
_rev: '1-70aa8fe77bbe596bded4a9de3aa185e4',
"bar": "foo"
}
]
docs = docs.map(function(doc){
var del = {};
del['_id'] = doc['_id'];
del['_rev'] = doc['_rev'];
del['_deleted'] = true;
return del;
});
db.save(docs, callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment