MongoDB C++ Driver
legacy-1.1.2
|
Class representing the result of a write operations sent to the server. More...
#include <write_result.h>
Public Member Functions | |
WriteResult () | |
Creates an empty write result. | |
bool | hasErrors () const |
Returns true if there have been write errors of any kind. More... | |
bool | hasWriteErrors () const |
Returns true if there have been write errors. More... | |
bool | hasWriteConcernErrors () const |
Returns true if there have been write concern errors. More... | |
bool | hasModifiedCount () const |
Returns true if the number of modified documents is available. More... | |
int | nInserted () const |
The number of documents that were inserted. More... | |
int | nUpserted () const |
The number of documents that were upserted. More... | |
int | nMatched () const |
The number of documents that were matched. More... | |
int | nModified () const |
The number of documents that were modified. More... | |
int | nRemoved () const |
The number of documents that were removed. More... | |
const std::vector< BSONObj > & | upserted () const |
The information about documents that were upserted. More... | |
const std::vector< BSONObj > & | writeErrors () const |
Vector with the write errors that occurred. | |
const std::vector< BSONObj > & | writeConcernErrors () const |
Vector with the write concern errors that occurred. | |
Class representing the result of a write operations sent to the server.
bool mongo::WriteResult::hasErrors | ( | ) | const |
Returns true if there have been write errors of any kind.
This includes write errors and write concern errors.
bool mongo::WriteResult::hasModifiedCount | ( | ) | const |
Returns true if the number of modified documents is available.
This will not be true if any write response comes from a node running MongoDB <2.6.
Note: You can only call nModified() if hasModifiedCount() is true.
bool mongo::WriteResult::hasWriteConcernErrors | ( | ) | const |
Returns true if there have been write concern errors.
This class of error can occur after the execution of writes on the server if they cannot be fully persisted or replicated to fulfill given supplied level of write concern.
bool mongo::WriteResult::hasWriteErrors | ( | ) | const |
Returns true if there have been write errors.
These include duplicate key errors, etc... that are possibly encountered in the process of write execution on the server.
int mongo::WriteResult::nInserted | ( | ) | const |
The number of documents that were inserted.
Note: This field is always available.
int mongo::WriteResult::nMatched | ( | ) | const |
The number of documents that were matched.
Note: This field is always available.
int mongo::WriteResult::nModified | ( | ) | const |
The number of documents that were modified.
Warning: This field is only available if hasModifiedCount() is true.
int mongo::WriteResult::nRemoved | ( | ) | const |
The number of documents that were removed.
Note: This field is always available.
int mongo::WriteResult::nUpserted | ( | ) | const |
The number of documents that were upserted.
Note: This field is always available.
const std::vector<BSONObj>& mongo::WriteResult::upserted | ( | ) | const |
The information about documents that were upserted.
Note: The objects in the vector have an "index" and "_id" field.