summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-08-02 16:58:17 -0400
committerEliot Horowitz <eliot@10gen.com>2010-08-02 16:58:17 -0400
commitac5914b66f01fdbcbbfdc77dcf90a816b1d27914 (patch)
tree433d2428d649d19772500e16f591516c4f685cab /shell
parentbdc79d0963c7fb8109b3797d713114bb1584c342 (diff)
downloadmongo-ac5914b66f01fdbcbbfdc77dcf90a816b1d27914.tar.gz
getLastErrorObj( w , wtimeout )
Diffstat (limited to 'shell')
-rw-r--r--shell/db.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/shell/db.js b/shell/db.js
index eef7d8dcef0..829969540f2 100644
--- a/shell/db.js
+++ b/shell/db.js
@@ -478,6 +478,12 @@ DB.prototype.forceError = function(){
}
DB.prototype.getLastError = function( w , wtimeout ){
+ var res = this.getLastErrorObj( w , wtimeout );
+ if ( ! res.ok )
+ throw "getlasterror failed: " + tojson( res );
+ return res.err;
+}
+DB.prototype.getLastErrorObj = function( w , wtimeout ){
var cmd = { getlasterror : 1 };
if ( w ){
cmd.w = w;
@@ -485,12 +491,7 @@ DB.prototype.getLastError = function( w , wtimeout ){
cmd.wtimeout = wtimeout;
}
var res = this.runCommand( cmd );
- if ( ! res.ok )
- throw "getlasterror failed: " + tojson( res );
- return res.err;
-}
-DB.prototype.getLastErrorObj = function(){
- var res = this.runCommand( { getlasterror : 1 } );
+
if ( ! res.ok )
throw "getlasterror failed: " + tojson( res );
return res;