Merge pull request #89 from Wizek/master
Call back even if the collection was empty to begin with.
This commit is contained in:
commit
9e2b9e1272
|
@ -183,6 +183,7 @@ MongooseAdapter.prototype.destroyAll = function destroyAll(model, callback) {
|
||||||
this._models[model].find(function (err, data) {
|
this._models[model].find(function (err, data) {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
wait = data.length;
|
wait = data.length;
|
||||||
|
if (!data.length) return callback(null);
|
||||||
data.forEach(function (obj) {
|
data.forEach(function (obj) {
|
||||||
obj.remove(done)
|
obj.remove(done)
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue