From 483c90a314e5ff45a38f268929b37b25de056eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20L=C3=B3pez=20Guevara?= Date: Tue, 10 Sep 2019 14:41:47 -0300 Subject: [PATCH] fix findOneAndUpdate with { runValidators: true } options TypeError: Cannot read property '_update' of undefined --- lib/query.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/query.js b/lib/query.js index c8646edc3c8..89a27f3166e 100644 --- a/lib/query.js +++ b/lib/query.js @@ -3543,10 +3543,10 @@ Query.prototype._findAndModify = function(type, callback) { if (error) { return callback(error); } - _legacyFindAndModify.call(_this, castedQuery, this._update, opts, cb); + _legacyFindAndModify.call(_this, castedQuery, _this._update, opts, cb); }); } else { - _legacyFindAndModify.call(_this, castedQuery, this._update, opts, cb); + _legacyFindAndModify.call(_this, castedQuery, _this._update, opts, cb); } return this;