
/**
 * Module dependencies.
 */

var mongoose = require('mongoose')
  , async = require('async')
  , Article = mongoose.model('Article')
  , User = mongoose.model('User')

/**
 * Clear database
 *
 * @param {Function} done
 * @api public
 */

exports.clearDb = function (done) {
  var callback = function (item, fn) { item.remove(fn) }

  async.parallel([
    function (cb) {
      User.find().exec(function (err, users) {
        async.forEach(users, callback, cb)
      })
    },
    function (cb) {
      Article.find().exec(function (err, apps) {
        async.forEach(apps, callback, cb)
      })
    }
  ], done)
}

@@ -279,327 +279,139 @@
 %7B%0A  
-var callback = function (item, fn) %7B item.remove(fn) %7D%0A%0A  async.parallel(%5B%0A    function (cb) %7B%0A      User.find().exec(function (err, users) %7B%0A        async.forEach(users, callback, cb)%0A      %7D)%0A    %7D,%0A    function (cb) %7B%0A      Article.find().exec(function (err, apps) %7B%0A        async.forEach(apps, callback, cb)%0A      %7D
+async.parallel(%5B%0A    function (cb) %7B%0A      User.collection.remove(cb)%0A    %7D,%0A    function (cb) %7B%0A      Article.collection.remove(cb
 )%0A  

use collection.remove to empty collections