Mangrove
The C++ Object Document Mapper for MongoDB
Public Member Functions | List of all members
mangrove::not_expr< Expr > Class Template Reference

This represents an expression with the $not operator, which wraps a comparison expression and negates it. More...

#include <query_builder.hpp>

Public Member Functions

constexpr not_expr (const Expr &expr)
 Creates a $not expression that negates the given comparison expression. 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: {$not: {$cmp: val}}". More...
 
 operator bsoncxx::document::view_or_value () const
 Converts the expression to a BSON filter for a query. More...
 

Detailed Description

template<typename Expr>
class mangrove::not_expr< Expr >

This represents an expression with the $not operator, which wraps a comparison expression and negates it.

Constructor & Destructor Documentation

template<typename Expr >
constexpr mangrove::not_expr< Expr >::not_expr ( const Expr &  expr)
inline

Creates a $not expression that negates the given comparison expression.

Parameters
exprA comparison expression

Member Function Documentation

template<typename Expr >
void mangrove::not_expr< Expr >::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: {$not: {$cmp: val}}".

Parameters
buildera BSON core builder
wrapWhether to wrap the BSON inside a document.
omit_nameWhether to skip the name of the field. This is used primarily in $elemMatch queries with scalar arrays, so one can have a query like {array: {
elemMatch
{

not: {$gt: 5}}}}

template<typename Expr >
mangrove::not_expr< 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: {$cmp: val}}".


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