Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make findAndModify helper function return null rather than {} (no cha…

…nge to server API)
  • Loading branch information...
commit fe54b5da1f9ca9fd617d09f762e73df22df7b414 1 parent 224ca4a
@RedBeard0531 RedBeard0531 authored
Showing with 3 additions and 3 deletions.
  1. +2 −2 jstests/find_and_modify.js
  2. +1 −1  shell/collection.js
View
4 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);
View
2  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 );
}
Please sign in to comment.
Something went wrong with that request. Please try again.