Skip to content

Instantly share code, notes, and snippets.

@aslakhellesoy
Created September 17, 2014 17:30
Show Gist options
  • Select an option

  • Save aslakhellesoy/e15847d7b26e2caafc34 to your computer and use it in GitHub Desktop.

Select an option

Save aslakhellesoy/e15847d7b26e2caafc34 to your computer and use it in GitHub Desktop.
Some code I use in tests to drop collections between tests.
var async = require('async');
var collections = ['projects', 'users', 'drafts', 'share_docs', 'share_docs_ops'];
module.exports = function(db, cb) {
function dropCollection(name, cb) {
db.collection(name, function(err, collection) {
if(err) return cb(err);
collection.drop(cb);
});
}
async.each(collections, dropCollection, cb);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment