|
constexpr | comparison_expr (const NvpT &nvp, const U &field, const char *op) |
| Constructs a query expression for the given key, value, and comparison type. More...
|
|
constexpr | comparison_expr (const comparison_expr &expr, const char *op) |
| Takes a comparison expression, and creates a new one with a different operator, but the same value and field. 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: {$cmp: val}", where $cmp is some comparison operator. More...
|
|
| operator bsoncxx::document::view_or_value () const |
| Converts the expression to a BSON filter for a query. More...
|
|
template<typename NvpT, typename U>
class mangrove::comparison_expr< NvpT, U >
Represents a query expression with the syntax "key: {$op: value}".
This usually means queries that are comparisons, such as (User.age > 21). However, this also covers operators such as $exists, or any operator that has the above syntax.
- Template Parameters
-
NvpT | The type of the name-value pair this expression uses. |
U | The type of the value to compare against. This could be the same as the value type of NvpT, or the type of some other parameter, or even a query builder expression. |
template<typename NvpT, typename U>
Takes a comparison expression, and creates a new one with a different operator, but the same value and field.
This is primarily used to wrap $regex operators in $not, since $not cannot contains a $regex operator, it must directly contain the regex itself.
- Parameters
-
expr | A comparison expresison with a similar field type and value type. |
op | The new operator to use. |