diff --git a/lib/dao.js b/lib/dao.js index c2580c79..44979050 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -370,7 +370,7 @@ DataAccessObject.updateOrCreate = DataAccessObject.upsert = function upsert(data } var context = { - Model: Model, + Model: Model, query: byIdQuery(Model, id), hookState: hookState, options: options @@ -410,7 +410,7 @@ DataAccessObject.updateOrCreate = DataAccessObject.upsert = function upsert(data self.getDataSource().connector .updateOrCreate(Model.modelName, update, done); - function done(err, data, result) { + function done(err, data, info) { var obj; if (data && !(data instanceof Model)) { inst._initProperties(data, { persisted: true }); @@ -427,7 +427,7 @@ DataAccessObject.updateOrCreate = DataAccessObject.upsert = function upsert(data var context = { Model: Model, instance: obj, - isNewInstance: result ? result.isNewInstance : undefined, + isNewInstance: info ? info.isNewInstance : undefined, hookState: hookState, options: options }; @@ -1356,11 +1356,11 @@ DataAccessObject.remove = DataAccessObject.deleteAll = DataAccessObject.destroyA cb = cb || utils.createPromiseCallback(); where = where || {}; options = options || {}; - + assert(typeof where === 'object', 'The where argument must be an object'); assert(typeof options === 'object', 'The options argument must be an object'); assert(typeof cb === 'function', 'The cb argument must be a function'); - + var hookState = {}; var query = { where: where }; @@ -1593,7 +1593,7 @@ DataAccessObject.prototype.save = function (options, cb) { assert(typeof options === 'object', 'The options argument should be an object'); assert(typeof cb === 'function', 'The cb argument should be a function'); - + var hookState = {}; if (options.validate === undefined) {