This class represents a query expression using the $mod operator, that checks the modulus of a certain numerical field.
More...
#include <query_builder.hpp>
|
constexpr | mod_expr (NvpT nvp, const int &divisor, const int &remainder) |
| Constructs a mod_expr that represents a query with the $mod operator. More...
|
|
std::string & | append_name (std::string &s) const |
| Appends the name of the contained field to a string.
|
|
void | append_to_bson (bsoncxx::builder::core &builder, bool wrap=false, bool omit_name=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...
|
|
template<typename NvpT>
class mangrove::mod_expr< NvpT >
This class represents a query expression using the $mod operator, that checks the modulus of a certain numerical field.
Constructs a mod_expr that represents a query with the $mod operator.
- Parameters
-
nvp | The name-value pair to compare against. |
divisor | The divisor used in the modulus operation. |
remainder | The remainder produced when dividing the field by the divisor. |
template<typename NvpT >
void mangrove::mod_expr< NvpT >::append_to_bson |
( |
bsoncxx::builder::core & |
builder, |
|
|
bool |
wrap = false , |
|
|
bool |
omit_name = false |
|
) |
| const |
|
inline |
Appends this expression to a BSON core builder, as a key-value pair of the form " key: { $mod: [ divisor, remainder ] } ".
- Parameters
-
builder | a BSON core builder |
wrap | Whether to wrap the BSON inside a document. |
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 files: