MongoDB C++ Driver  mongocxx-3.7.0
Public Member Functions | List of all members
mongocxx::model::delete_one Class Reference

Class representing a MongoDB delete operation that removes a single document. More...

#include <delete_one.hpp>

Public Member Functions

 delete_one (bsoncxx::document::view_or_value filter)
 Constructs a delete operation that will delete the first document matching the filter. More...
 
const bsoncxx::document::view_or_valuefilter () const
 Gets the filter on this delete operation. More...
 
delete_onecollation (bsoncxx::document::view_or_value collation)
 Sets the collation for this delete operation. More...
 
const stdx::optional< bsoncxx::document::view_or_value > & collation () const
 Gets the collation option for this delete operation. More...
 
delete_onehint (class hint index_hint)
 Sets the index to use for this operation. More...
 
const stdx::optional< class hint > & hint () const
 Gets the current hint. More...
 

Detailed Description

Class representing a MongoDB delete operation that removes a single document.

Constructor & Destructor Documentation

◆ delete_one()

mongocxx::model::delete_one::delete_one ( bsoncxx::document::view_or_value  filter)

Constructs a delete operation that will delete the first document matching the filter.

Parameters
filterDocument representing the criteria for deletion.

Member Function Documentation

◆ collation() [1/2]

const stdx::optional<bsoncxx::document::view_or_value>& mongocxx::model::delete_one::collation ( ) const

Gets the collation option for this delete operation.

Returns
The optional value of the collation option.
See also
https://docs.mongodb.com/manual/reference/collation/

◆ collation() [2/2]

delete_one& mongocxx::model::delete_one::collation ( bsoncxx::document::view_or_value  collation)

Sets the collation for this delete operation.

Parameters
collationThe new collation.
See also
https://docs.mongodb.com/manual/reference/collation/

◆ filter()

const bsoncxx::document::view_or_value& mongocxx::model::delete_one::filter ( ) const

Gets the filter on this delete operation.

Returns
The filter to be used for the delete operation.

◆ hint() [1/2]

const stdx::optional<class hint>& mongocxx::model::delete_one::hint ( ) const

Gets the current hint.

Returns
The current hint, if one is set.

◆ hint() [2/2]

delete_one& mongocxx::model::delete_one::hint ( class hint  index_hint)

Sets the index to use for this operation.

Note
if the server already has a cached shape for this query, it may ignore a hint.
Parameters
index_hintObject representing the index to use.
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: