MongoDB C++ Driver
mongocxx-3.0.1
|
Class representing the optional arguments to a MongoDB update operation. More...
#include <update.hpp>
Public Member Functions | |
void | upsert (bool upsert) |
Sets the upsert option. More... | |
const stdx::optional< bool > & | upsert () const |
Gets the current value of the upsert option. More... | |
void | bypass_document_validation (bool bypass_document_validation) |
Sets the bypass_document_validation option. More... | |
const stdx::optional< bool > & | bypass_document_validation () const |
Gets the current value of the bypass_document_validation option. More... | |
void | write_concern (class write_concern wc) |
Sets the write_concern for this operation. More... | |
const stdx::optional< class write_concern > & | write_concern () const |
The current write_concern for this operation. More... | |
Class representing the optional arguments to a MongoDB update operation.
void mongocxx::options::update::bypass_document_validation | ( | bool | bypass_document_validation | ) |
Sets the bypass_document_validation option.
If true, allows the write to opt-out of document level validation.
bypass_document_validation | Whether or not to bypass document validation |
const stdx::optional<bool>& mongocxx::options::update::bypass_document_validation | ( | ) | const |
Gets the current value of the bypass_document_validation option.
void mongocxx::options::update::upsert | ( | bool | upsert | ) |
Sets the upsert option.
By default, if no document matches the filter, the update operation does nothing. However, by specifying upsert as true
, this operation either updates matching documents or inserts a new document using the update specification if no matching document exists.
upsert | If set to true , creates a new document when no document matches the query criteria. The server-side default is false , which does not insert a new document if a match is not found. |
const stdx::optional<bool>& mongocxx::options::update::upsert | ( | ) | const |
Gets the current value of the upsert option.
void mongocxx::options::update::write_concern | ( | class write_concern | wc | ) |
Sets the write_concern for this operation.
wc | The new write_concern |
const stdx::optional<class write_concern>& mongocxx::options::update::write_concern | ( | ) | const |
The current write_concern for this operation.