MongoDB C++ Driver  mongocxx-3.4.0
Public Member Functions | Related Functions | List of all members
mongocxx::hint Class Reference

Class representing a hint to be passed to a database operation. More...

#include <hint.hpp>

Public Member Functions

 hint (bsoncxx::document::view_or_value index)
 Constructs a new hint. More...
 
 hint (bsoncxx::string::view_or_value index)
 Constructs a new hint. More...
 
bsoncxx::types::value to_value () const
 Returns a types::value representing this hint. More...
 
MONGOCXX_DEPRECATED bsoncxx::document::value to_document () const
 Return a bson document representing this hint. More...
 
 operator bsoncxx::types::value () const
 Returns a types::value representing this hint. More...
 
MONGOCXX_DEPRECATED operator bsoncxx::document::value () const
 

Related Functions

(Note that these are not member functions.)

bool operator== (std::string index, const hint &index_hint)
 Convenience methods to compare for equality against an index name. More...
 
bool operator== (bsoncxx::document::view index, const hint &index_hint)
 Convenience methods to compare for equality against an index document. More...
 
bool operator!= (const hint &index_hint, std::string index)
 Convenience methods to compare for inequality against an index name. More...
 
bool operator!= (const hint &index_hint, bsoncxx::document::view index)
 Convenience methods to compare for equality against an index document. More...
 
bool operator== (const hint &index_hint, std::string index)
 Compare this hint to a string for (in)-equality.
 
bool operator== (const hint &index_hint, bsoncxx::document::view index)
 Compare this hint to a string for (in)-equality.
 

Detailed Description

Class representing a hint to be passed to a database operation.

Constructor & Destructor Documentation

◆ hint() [1/2]

mongocxx::hint::hint ( bsoncxx::document::view_or_value  index)

Constructs a new hint.

Note: this constructor is purposefully not explicit, to allow conversion from either document::view or document::value to view_or_value.

Parameters
indexDocument view or value representing the index to be used.

◆ hint() [2/2]

mongocxx::hint::hint ( bsoncxx::string::view_or_value  index)
explicit

Constructs a new hint.

Parameters
indexString representing the name of the index to be used.

Member Function Documentation

◆ operator bsoncxx::document::value()

mongocxx::hint::operator bsoncxx::document::value ( ) const
Deprecated:
This method has been deprecated in favor of operator bsoncxx::types::value().

◆ operator bsoncxx::types::value()

mongocxx::hint::operator bsoncxx::types::value ( ) const

Returns a types::value representing this hint.

Returns
Hint, as a types::value. The caller must ensure that the returned object not outlive the hint object that it was created from.

◆ to_document()

MONGOCXX_DEPRECATED bsoncxx::document::value mongocxx::hint::to_document ( ) const

Return a bson document representing this hint.

Deprecated:
This method has been deprecated in favor of to_value().
Returns
Hint, as a document.

◆ to_value()

bsoncxx::types::value mongocxx::hint::to_value ( ) const

Returns a types::value representing this hint.

Returns
Hint, as a types::value. The caller must ensure that the returned object not outlive the hint object that it was created from.

Friends And Related Function Documentation

◆ operator!=() [1/2]

bool operator!= ( const hint index_hint,
std::string  index 
)
related

Convenience methods to compare for inequality against an index name.

Return true if this hint contains an index name that matches.

◆ operator!=() [2/2]

bool operator!= ( const hint index_hint,
bsoncxx::document::view  index 
)
related

Convenience methods to compare for equality against an index document.

Return true if this hint contains an index document that matches.

◆ operator==() [1/2]

bool operator== ( std::string  index,
const hint index_hint 
)
related

Convenience methods to compare for equality against an index name.

Return true if this hint contains an index name that matches.

◆ operator==() [2/2]

bool operator== ( bsoncxx::document::view  index,
const hint index_hint 
)
related

Convenience methods to compare for equality against an index document.

Return true if this hint contains an index document that matches.


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