Created
September 17, 2014 17:30
-
-
Save aslakhellesoy/e15847d7b26e2caafc34 to your computer and use it in GitHub Desktop.
Some code I use in tests to drop collections between tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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