diff options
Diffstat (limited to 'src/mongo/client/dbclient.cpp')
| -rw-r--r-- | src/mongo/client/dbclient.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp index 5af4c623982..1177cfd1172 100644 --- a/src/mongo/client/dbclient.cpp +++ b/src/mongo/client/dbclient.cpp @@ -36,6 +36,8 @@ namespace mongo { + AtomicInt64 DBClientBase::ConnectionIdSequence; + void ConnectionString::_fillServers( string s ) { // @@ -389,6 +391,14 @@ namespace mongo { } BSONObj DBClientWithCommands::getLastErrorDetailed(bool fsync, bool j, int w, int wtimeout) { + return getLastErrorDetailed("admin", fsync, j, w, wtimeout); + } + + BSONObj DBClientWithCommands::getLastErrorDetailed(const std::string& db, + bool fsync, + bool j, + int w, + int wtimeout) { BSONObj info; BSONObjBuilder b; b.append( "getlasterror", 1 ); @@ -407,13 +417,21 @@ namespace mongo { if ( wtimeout > 0 ) b.append( "wtimeout", wtimeout ); - runCommand("admin", b.obj(), info); + runCommand(db, b.obj(), info); return info; } string DBClientWithCommands::getLastError(bool fsync, bool j, int w, int wtimeout) { - BSONObj info = getLastErrorDetailed(fsync, j, w, wtimeout); + return getLastError("admin", fsync, j, w, wtimeout); + } + + string DBClientWithCommands::getLastError(const std::string& db, + bool fsync, + bool j, + int w, + int wtimeout) { + BSONObj info = getLastErrorDetailed(db, fsync, j, w, wtimeout); return getLastErrorString( info ); } |
