Merge pull request #89 from Wizek/master

Call back even if the collection was empty to begin with.
This commit is contained in:
Anatoliy Chakkaev 2012-06-05 16:37:56 -07:00
commit 9e2b9e1272
1 changed files with 1 additions and 0 deletions

View File

@ -183,6 +183,7 @@ MongooseAdapter.prototype.destroyAll = function destroyAll(model, callback) {
this._models[model].find(function (err, data) {
if (err) return callback(err);
wait = data.length;
if (!data.length) return callback(null);
data.forEach(function (obj) {
obj.remove(done)
});