From da252d98e2baaa247b7d58d452e1326a00f57722 Mon Sep 17 00:00:00 2001 From: Eduardo Sorribas Date: Fri, 25 Jul 2014 17:03:46 +0200 Subject: [PATCH] Stop using err.lastErrorObject (it's not in the driver anymore). --- index.js | 2 +- tests/test-find-and-modify.js | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index fe5ca8e..e85d10d 100644 --- a/index.js +++ b/index.js @@ -214,7 +214,7 @@ Collection.prototype.findAndModify = function(options, callback) { // property is added to the err argument instead. // If the findAndModify command finds no matching document, when performing update or remove, // no lastErrorObject is included (so we fake it). - (callback || noop)(err, doc, (err && err.lastErrorObject) || (obj && obj.lastErrorObject) || { n: 0 }); + (callback || noop)(err, doc, (obj && obj.lastErrorObject) || { n: 0 }); }]); }; diff --git a/tests/test-find-and-modify.js b/tests/test-find-and-modify.js index 6baee42..1e5422d 100644 --- a/tests/test-find-and-modify.js +++ b/tests/test-find-and-modify.js @@ -63,17 +63,7 @@ insert([{ assert.ok(!err); assert.equal(lastErrorObject.n, 0); - // Correct error handling - db.a.findAndModify({ - update: { $illigal: 1 } - }, function(err, doc, lastErrorObject) { - assert(err instanceof Error); - assert.equal(doc, null); - assert.equal(lastErrorObject.n, 0); - assert.equal(typeof lastErrorObject.err, 'string'); - - done(); - }); + done(); }); }); });