diff --git a/lib/collection.js b/lib/collection.js index ba40d4a..1cc3dc1 100644 --- a/lib/collection.js +++ b/lib/collection.js @@ -155,7 +155,7 @@ SkinCollection.prototype.updateById = function (id, doc, callback) { var _this = this; if (callback) { callback = function(error, res) { - oldCb.call(_this, error, res.result); + oldCb.call(_this, error, !!res ? res.result : null); }; } return this._operateById('update', id, [id, doc, callback]); @@ -173,7 +173,7 @@ SkinCollection.prototype.removeById = function (id, callback) { var _this = this; if (callback) { callback = function(error, res) { - oldCb.call(_this, error, res.result.n); + oldCb.call(_this, error, !!res ? res.result.n : null); }; } return this._operateById('remove', id, [id, callback]);