diff --git a/jstests/find_and_modify.js b/jstests/find_and_modify.js index 5e10079db909a..a80859ab60ca3 100644 --- a/jstests/find_and_modify.js +++ b/jstests/find_and_modify.js @@ -33,6 +33,6 @@ assert.eq(out.priority, 1); out = t.findAndModify({sort:{priority:1}, remove:1}); assert.eq(out.priority, 2); -// return empty obj if no matches (drivers may handle this differently) +// return null (was {} before 1.5.4) if no matches (drivers may handle this differently) out = t.findAndModify({query:{no_such_field:1}, remove:1}); -assert.eq(out, {}); +assert.eq(out, null); diff --git a/shell/collection.js b/shell/collection.js index d97eece8a8e84..1f06a132856ae 100644 --- a/shell/collection.js +++ b/shell/collection.js @@ -337,7 +337,7 @@ DBCollection.prototype.findAndModify = function(args){ var ret = this._db.runCommand( cmd ); if ( ! ret.ok ){ if (ret.errmsg == "No matching object found"){ - return {}; + return null; } throw "findAndModifyFailed failed: " + tojson( ret.errmsg ); }