index.js
function someCollections(db, collections, next) {

  var last = ~~collections.length, counter = 0;
  if (last === 0) { // empty set
    return next(null);
  }

  collections.forEach(function(collection) {

    db.collection(collection, function(err, collection) {

      logger('select collection ' + collection.collectionName);
      if (err) {
        return last === ++counter ? next(err) : error(err);
      }
      collection.drop(function(err) {

        if (err) {
          error(err); // log if missing
        }
        return last === ++counter ? next(null) : null;
      });
    });
  });
}
function someCollections(db, collections, next) {

  var last = ~~collections.length, counter = 0;
  if (last === 0) { // empty set
    return next(null);
  }

  collections.forEach(function(collection) {

    db.collection(collection, function(err, collection) {

      logger('select collection ' + collection.collectionName);
      if (err) {
        return last === ++counter ? next(err) : error(err);
      }
      collection.drop(function(err) {

        if (err) {
          error(err); // log if missing
        }
        return last === ++counter ? next(null) : null;
      });
    });
  });
}
function someCollections ( db , collections , next ) { var last = ~ ~ collections . length , counter = 0 ; if ( last === 0 ) { // empty set return next ( null ) ; } collections . forEach ( function ( collection ) { db . collection ( collection , function ( err , collection ) { logger ( 'select collection ' + collection . collectionName ) ; if ( err ) { return last === ++ counter ? next ( err ) : error ( err ) ; } collection . drop ( function ( err ) { if ( err ) { error ( err ) ; // log if missing } return last === ++ counter ? next ( null ) : null ; } ) ; } ) ; } ) ; }
drop data from some collections

@function someCollections
@param {Object} db - database
@param {Array} collections - selected collections
@param {Function} next - callback
drop data from some collections