From 37c1748b40de8c424f24ca7d1594e158a17f050e Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Thu, 13 Jul 2017 14:57:21 +0200 Subject: [PATCH] fix: patch findAndModify updateOrCreate to apply context.bind additional fix for PR #275 --- lib/mongodb.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mongodb.js b/lib/mongodb.js index 060833326..4ed1b0437 100644 --- a/lib/mongodb.js +++ b/lib/mongodb.js @@ -598,7 +598,7 @@ MongoDB.prototype.updateOrCreate = function updateOrCreate(model, data, options, _id: oid, }, [ ['_id', 'asc'], - ], data, { upsert: true, new: true }, function(err, result) { + ], data, { upsert: true, new: true }, patchWithContext(function(err, result) { if (self.debug) { debug('updateOrCreate.callback', model, id, err, result); } @@ -620,7 +620,7 @@ MongoDB.prototype.updateOrCreate = function updateOrCreate(model, data, options, } callback && callback(err, object, info); - }); + })); }; /**