lib/middleware/envMongoDb.js
function dropEnvironmentDatabase(domain, env, next) {
  _getEnvironmentDatabase({
    domain: domain,
    environment: env
  }, function (err, found) {
    if (err) {
      return next(common.buildErrorObject({
        err: err,
        msg: 'Failed to get environment',
        httpCode: 500
      }));
    }
    if (!found) {
      log.logger.info("no environment db for " + env + " moving on");
      return next();
    }
    found.dropDb(config.getConfig(), function dropped(err) {
      if (err) {
        log.logger.error('Failed to delete model');
        return next(common.buildErrorObject({
          err: err,
          msg: 'Failed to drop environment db',
          httpCode: 500
        }));
      }
      found.remove(next);
    });
  });
}
function dropEnvironmentDatabase(domain, env, next) {
  _getEnvironmentDatabase({
    domain: domain,
    environment: env
  }, function (err, found) {
    if (err) {
      return next(common.buildErrorObject({
        err: err,
        msg: 'Failed to get environment',
        httpCode: 500
      }));
    }
    if (!found) {
      log.logger.info("no environment db for " + env + " moving on");
      return next();
    }
    found.dropDb(config.getConfig(), function dropped(err) {
      if (err) {
        log.logger.error('Failed to delete model');
        return next(common.buildErrorObject({
          err: err,
          msg: 'Failed to drop environment db',
          httpCode: 500
        }));
      }
      found.remove(next);
    });
  });
}
function dropEnvironmentDatabase ( domain , env , next ) { _getEnvironmentDatabase ( { domain : domain , environment : env } , function ( err , found ) { if ( err ) { return next ( common . buildErrorObject ( { err : err , msg : 'Failed to get environment' , httpCode : 500 } ) ) ; } if ( ! found ) { log . logger . info ( "no environment db for " + env + " moving on" ) ; return next ( ) ; } found . dropDb ( config . getConfig ( ) , function dropped ( err ) { if ( err ) { log . logger . error ( 'Failed to delete model' ) ; return next ( common . buildErrorObject ( { err : err , msg : 'Failed to drop environment db' , httpCode : 500 } ) ) ; } found . remove ( next ) ; } ) ; } ) ; }
DropEnvironmentDatabase removes the database for specific environment completely
DropEnvironmentDatabase removes the database for specific environment completely