MongoDB C++ Driver mongocxx-3.0.3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
mongocxx::options::find_one_and_replace Class Reference

Class representing the optional arguments to a MongoDB find_and_modify replace operation. More...

#include <find_one_and_replace.hpp>

Public Member Functions

find_one_and_replacebypass_document_validation (bool bypass_document_validation)
 Whether or not to bypass document validation for this operation.
 
const stdx::optional< bool > & bypass_document_validation () const
 The current setting for bypassing document validation.
 
find_one_and_replacemax_time (std::chrono::milliseconds max_time)
 Sets the maximum amount of time for this operation to run (server-side) in milliseconds.
 
const stdx::optional< std::chrono::milliseconds > & max_time () const
 The current max_time setting.
 
find_one_and_replaceprojection (bsoncxx::document::view_or_value projection)
 Sets a projection, which limits the fields to return.
 
const stdx::optional< bsoncxx::document::view_or_value > & projection () const
 Gets the current projection for this operation.
 
find_one_and_replacereturn_document (return_document return_document)
 Set the desired version of the replaced document to return, either the original document, or the replacement.
 
const stdx::optional< mongocxx::options::return_document > & return_document () const
 Which version of the replaced document to return.
 
find_one_and_replacesort (bsoncxx::document::view_or_value ordering)
 Sets the order by which to search the collection for a matching document.
 
const stdx::optional< bsoncxx::document::view_or_value > & sort () const
 Gets the current sort ordering.
 
find_one_and_replaceupsert (bool upsert)
 Sets the upsert flag on the operation.
 
const stdx::optional< bool > & upsert () const
 Gets the current upsert setting.
 

Detailed Description

Class representing the optional arguments to a MongoDB find_and_modify replace operation.

Member Function Documentation

◆ bypass_document_validation() [1/2]

const stdx::optional< bool > & mongocxx::options::find_one_and_replace::bypass_document_validation ( ) const

The current setting for bypassing document validation.

Returns
the current bypass document validation setting.

◆ bypass_document_validation() [2/2]

find_one_and_replace & mongocxx::options::find_one_and_replace::bypass_document_validation ( bool  bypass_document_validation)

Whether or not to bypass document validation for this operation.

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.
See also
https://docs.mongodb.org/manual/core/document-validation/#bypass-document-validation

◆ max_time() [1/2]

const stdx::optional< std::chrono::milliseconds > & mongocxx::options::find_one_and_replace::max_time ( ) const

The current max_time setting.

Returns
the current max allowed running time (in milliseconds).
See also
http://docs.mongodb.org/manual/reference/operator/meta/maxTimeMS

◆ max_time() [2/2]

find_one_and_replace & mongocxx::options::find_one_and_replace::max_time ( std::chrono::milliseconds  max_time)

Sets the maximum amount of time for this operation to run (server-side) in milliseconds.

Parameters
max_timeThe max amount of time (in milliseconds).
See also
http://docs.mongodb.org/manual/reference/operator/meta/maxTimeMS

◆ projection() [1/2]

const stdx::optional< bsoncxx::document::view_or_value > & mongocxx::options::find_one_and_replace::projection ( ) const

Gets the current projection for this operation.

Returns
The current projection.
See also
http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/

◆ projection() [2/2]

find_one_and_replace & mongocxx::options::find_one_and_replace::projection ( bsoncxx::document::view_or_value  projection)

Sets a projection, which limits the fields to return.

Parameters
projectionThe projection document.
See also
http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/

◆ return_document() [1/2]

const stdx::optional< mongocxx::options::return_document > & mongocxx::options::find_one_and_replace::return_document ( ) const

Which version of the replaced document to return.

Returns
Version of document to return, either original or replacement.
See also
http://docs.mongodb.org/manual/reference/command/findAndModify/
mongocxx::options::return_document

◆ return_document() [2/2]

find_one_and_replace & mongocxx::options::find_one_and_replace::return_document ( return_document  return_document)

Set the desired version of the replaced document to return, either the original document, or the replacement.

By default, the original document is returned.

Parameters
return_documentVersion of document to return, either original or replaced.
See also
http://docs.mongodb.org/manual/reference/command/findAndModify/
mongocxx::options::return_document

◆ sort() [1/2]

const stdx::optional< bsoncxx::document::view_or_value > & mongocxx::options::find_one_and_replace::sort ( ) const

Gets the current sort ordering.

Returns
The current sort ordering.
See also
http://docs.mongodb.org/manual/reference/command/findAndModify/

◆ sort() [2/2]

find_one_and_replace & mongocxx::options::find_one_and_replace::sort ( bsoncxx::document::view_or_value  ordering)

Sets the order by which to search the collection for a matching document.

Warning
This can influence which document the operation modifies if the provided filter selects multiple documents.
Parameters
orderingDocument describing the order of the documents to be returned.
See also
http://docs.mongodb.org/manual/reference/command/findAndModify/

◆ upsert() [1/2]

const stdx::optional< bool > & mongocxx::options::find_one_and_replace::upsert ( ) const

Gets the current upsert setting.

Returns
The current upsert setting.
See also
http://docs.mongodb.org/manual/reference/command/findAndModify/

◆ upsert() [2/2]

find_one_and_replace & mongocxx::options::find_one_and_replace::upsert ( bool  upsert)

Sets the upsert flag on the operation.

When true, the operation creates a new document if no document matches the filter. When false, this operation will do nothing if there are no matching documents. The server-side default is false.

Parameters
upsertWhether or not to perform an upsert.
See also
http://docs.mongodb.org/manual/reference/command/findAndModify/

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