From a5ec3abcad9519a2de4eefb9fbf7d6167c7ed70d Mon Sep 17 00:00:00 2001 From: ken Date: Fri, 15 Apr 2016 16:32:27 +0800 Subject: [PATCH] Update mongo.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加 beforeUpadte --- src/model/mongo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/model/mongo.js b/src/model/mongo.js index 2e2ce4b8..b923f9c1 100644 --- a/src/model/mongo.js +++ b/src/model/mongo.js @@ -176,6 +176,7 @@ export default class extends Base { this.where({[pk]: data[pk]}); delete data[pk]; } + data = await this.beforeUpdate(data, options); let result = await this.db().update(data, options); await this.afterUpdate(data, options); return result.result.nModified || 0; @@ -348,4 +349,4 @@ export default class extends Base { return collection.indexes(); }); } -} \ No newline at end of file +}