mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
getLastErrorDetailed() for C++ client
This commit is contained in:
parent
8d07d50c48
commit
68c24f3595
@ -139,9 +139,14 @@ namespace mongo {
|
||||
|
||||
BSONObj getlasterrorcmdobj = fromjson("{getlasterror:1}");
|
||||
|
||||
string DBClientWithCommands::getLastError() {
|
||||
BSONObj DBClientWithCommands::getLastErrorDetailed() {
|
||||
BSONObj info;
|
||||
runCommand("admin", getlasterrorcmdobj, info);
|
||||
return info;
|
||||
}
|
||||
|
||||
string DBClientWithCommands::getLastError() {
|
||||
BSONObj info = getLastErrorDetailed();
|
||||
BSONElement e = info["err"];
|
||||
if( e.eoo() ) return "";
|
||||
if( e.type() == Object ) return e.toString();
|
||||
|
@ -363,9 +363,13 @@ namespace mongo {
|
||||
bool createCollection(const string &ns, unsigned size = 0, bool capped = false, int max = 0, BSONObj *info = 0);
|
||||
|
||||
/** Get error result from the last operation on this connection.
|
||||
@return error or empty string if no error.
|
||||
@return error message text, or empty string if no error.
|
||||
*/
|
||||
string getLastError();
|
||||
/** Get error result from the last operation on this connection.
|
||||
@return full error object.
|
||||
*/
|
||||
BSONObj getLastErrorDetailed();
|
||||
|
||||
/** Return the last error which has occurred, even if not the very last operation.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user