helpers/index.js
function dropCollections (db, each, fn) {
  if (each && !fn) { fn = each; each = null }
  var conn = db.connection
    , cols = Object.keys(conn.collections)

  cols.forEach(function (name, k) {
    console.log('name: ', name, k)
    conn.collections[name].drop(function (err) {
      if (err == 'ns not found') {
        err = null
      }
      each && each(err, name)
    })
  })
  fn && fn(null)
}
function dropCollections (db, each, fn) {
  if (each && !fn) { fn = each; each = null }
  var conn = db.connection
    , cols = Object.keys(conn.collections)

  cols.forEach(function (name, k) {
    console.log('name: ', name, k)
    conn.collections[name].drop(function (err) {
      if (err == 'ns not found') {
        err = null
      }
      each && each(err, name)
    })
  })
  fn && fn(null)
}
function dropCollections ( db , each , fn ) { if ( each && ! fn ) { fn = each ; each = null } var conn = db . connection , cols = Object . keys ( conn . collections ) cols . forEach ( function ( name , k ) { console . log ( 'name: ' , name , k ) conn . collections [ name ] . drop ( function ( err ) { if ( err == 'ns not found' ) { err = null } each && each ( err , name ) } ) } ) fn && fn ( null ) }
Drop all collections in a database
Drop all collections in a database