Mangrove
The C++ Object Document Mapper for MongoDB
Public Member Functions | List of all members
mangrove::text_search_expr Class Reference

Represents a query that performs a text search with the $text operator. More...

#include <query_builder.hpp>

Public Member Functions

 text_search_expr (const char *search, bsoncxx::stdx::optional< const char * > language=bsoncxx::stdx::nullopt, bsoncxx::stdx::optional< bool > case_sensitive=bsoncxx::stdx::nullopt, bsoncxx::stdx::optional< bool > diacritic_sensitive=bsoncxx::stdx::nullopt)
 Creates a text search expression. More...
 
void append_to_bson (bsoncxx::builder::core &builder, bool wrap=false) const
 Appends this expression to a BSON core builder, as a key-value pair of the form " key: { $mod: [ divisor, remainder ] } ". More...
 
 operator bsoncxx::document::view_or_value () const
 Converts the expression to a BSON filter for a query. More...
 

Detailed Description

Represents a query that performs a text search with the $text operator.

TODO check values of language against spec?

Constructor & Destructor Documentation

mangrove::text_search_expr::text_search_expr ( const char *  search,
bsoncxx::stdx::optional< const char * >  language = bsoncxx::stdx::nullopt,
bsoncxx::stdx::optional< bool >  case_sensitive = bsoncxx::stdx::nullopt,
bsoncxx::stdx::optional< bool >  diacritic_sensitive = bsoncxx::stdx::nullopt 
)
inline

Creates a text search expression.

These parameters correspond to the parameters for the $text operator in MongoDB.

Parameters
searchA string of terms use to query the text index.
languageThe language of the text index.
case_sensitiveA boolean flag to specify case-sensitive search. Optional, false by default.
diacritic_sensitiveA boolean flag to specify case-sensitive search. Optional, false by default.

Member Function Documentation

void mangrove::text_search_expr::append_to_bson ( bsoncxx::builder::core &  builder,
bool  wrap = false 
) const
inline

Appends this expression to a BSON core builder, as a key-value pair of the form " key: { $mod: [ divisor, remainder ] } ".

Parameters
buildera BSON core builder
wrapWhether to wrap the BSON inside a document.
mangrove::text_search_expr::operator bsoncxx::document::view_or_value ( ) const
inline

Converts the expression to a BSON filter for a query.

The resulting BSON is of the form "{ key: { $mod: [ divisor, remainder ] } }".


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