Skip to content

Instantly share code, notes, and snippets.

@ekmartin
Created February 14, 2015 14:29
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 ekmartin/a460bfa9792e812a2d3b to your computer and use it in GitHub Desktop.
Save ekmartin/a460bfa9792e812a2d3b to your computer and use it in GitHub Desktop.
clearCollections Mongoose
function clearCollections() {
var collections = _.values(mongoose.connection.collections);
return Bluebird.map(collections, function(collection) {
return collection.removeAsync();
});
}
before(function(done) {
mongoose.connection.on('connected', done);
});
beforeEach(function() {
return clearCollections();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment