MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
mongocxx::options::insert Class Reference

#include <mongocxx/v_noabi/mongocxx/options/insert.hpp>

Description

Public Member Functions

 insert ()=default
 Default initialization.
 insert (v1::insert_many_options opts)
 Construct with the mongocxx::v1 equivalent.
 insert (v1::insert_one_options opts)
 Construct with the mongocxx::v1 equivalent.
bsoncxx::v_noabi::stdx::optional< bool > const & bypass_document_validation () const
 Gets the current value of the bypass_document_validation option.
insertbypass_document_validation (bool bypass_document_validation)
 Sets the bypass_document_validation option. If true, allows the write to opt-out of document level validation.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > const & comment () const
 The current comment for this operation.
insertcomment (bsoncxx::v_noabi::types::bson_value::view_or_value comment)
 Sets the comment for this operation.
 operator v1::insert_many_options () const
 Convert to the mongocxx::v1 equivalent.
 operator v1::insert_one_options () const
 Convert to the mongocxx::v1 equivalent.
bsoncxx::v_noabi::stdx::optional< bool > const & ordered () const
 The current ordered value for this operation.
insertordered (bool ordered)
bsoncxx::v_noabi::stdx::optional< v_noabi::write_concern > const & write_concern () const
 The current write_concern for this operation.
insertwrite_concern (v_noabi::write_concern wc)
 Sets the write_concern for this operation.

Constructor & Destructor Documentation

◆ insert() [1/3]

Default initialization.

◆ insert() [2/3]

◆ insert() [3/3]

Member Function Documentation

◆ bypass_document_validation() [1/2]

Gets the current value of the bypass_document_validation option.

Returns
The optional value of the bypass_document_validation option.

◆ bypass_document_validation() [2/2]

insert & mongocxx::v_noabi::options::insert::bypass_document_validation ( bool bypass_document_validation)
inline

Sets the bypass_document_validation option. If true, allows the write to opt-out of document level validation.

Note
On servers >= 3.2, the server applies validation by default. On servers < 3.2, this option is ignored.
Parameters
bypass_document_validationWhether or not to bypass document validation
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.

◆ comment() [1/2]

◆ comment() [2/2]

Sets the comment for this operation.

Parameters
commentThe new comment.
See also
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.

◆ operator v1::insert_many_options()

mongocxx::v_noabi::options::insert::operator v1::insert_many_options ( ) const
inlineexplicit

Convert to the mongocxx::v1 equivalent.

◆ operator v1::insert_one_options()

mongocxx::v_noabi::options::insert::operator v1::insert_one_options ( ) const
inlineexplicit

Convert to the mongocxx::v1 equivalent.

Note
The ordered field is ignored.

◆ ordered() [1/2]

The current ordered value for this operation.

Returns
The current ordered value.
See also

◆ ordered() [2/2]

Note
: This applies only to insert_many and is ignored for insert_one.

If true, when an insert fails, return without performing the remaining writes. If false, when a write fails, continue with the remaining writes, if any. Inserts can be performed in any order if this is false. Defaults to true.

Parameters
orderedWhether or not the insert_many will be ordered.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ write_concern() [1/2]

◆ write_concern() [2/2]

Sets the write_concern for this operation.

Parameters
wcThe new write_concern.
See also
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.

The documentation for this class was generated from the following file: