Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…nge to server API)
  • Loading branch information...
commit fe54b5da1f9ca9fd617d09f762e73df22df7b414 1 parent 224ca4a
Mathias Stearn authored July 01, 2010
4  jstests/find_and_modify.js
@@ -33,6 +33,6 @@ assert.eq(out.priority, 1);
33 33
 out = t.findAndModify({sort:{priority:1}, remove:1});
34 34
 assert.eq(out.priority, 2);
35 35
 
36  
-// return empty obj if no matches (drivers may handle this differently)
  36
+// return null (was {} before 1.5.4) if no matches (drivers may handle this differently)
37 37
 out = t.findAndModify({query:{no_such_field:1}, remove:1});
38  
-assert.eq(out, {});
  38
+assert.eq(out, null);
2  shell/collection.js
@@ -337,7 +337,7 @@ DBCollection.prototype.findAndModify = function(args){
337 337
     var ret = this._db.runCommand( cmd );
338 338
     if ( ! ret.ok ){
339 339
         if (ret.errmsg == "No matching object found"){
340  
-            return {};
  340
+            return null;
341 341
         }
342 342
         throw "findAndModifyFailed failed: " + tojson( ret.errmsg );
343 343
     }

0 notes on commit fe54b5d

Please sign in to comment.
Something went wrong with that request. Please try again.