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

An expression that uses the $addToSet operator to add unique elements to an array. More...

#include <query_builder.hpp>

Public Member Functions

constexpr add_to_set_update_expr (const NvpT &nvp, const U &val, bool each)
 Constructs an add_to_set_update_expr with the given parameters. More...
 
void append_to_bson (bsoncxx::builder::core &builder, bool wrap=false) const
 Appends this query to a BSON core builder as an expression '. More...
 

Detailed Description

template<typename NvpT, typename U>
class mangrove::add_to_set_update_expr< NvpT, U >

An expression that uses the $addToSet operator to add unique elements to an array.

Template Parameters
NvpTThe name-value pair to use
UThe type of the value to pass to $addToSet

Constructor & Destructor Documentation

template<typename NvpT , typename U >
constexpr mangrove::add_to_set_update_expr< NvpT, U >::add_to_set_update_expr ( const NvpT &  nvp,
const U &  val,
bool  each 
)
inline

Constructs an add_to_set_update_expr with the given parameters.

Parameters
nvpThe given field.
valThe value to add to the field.
eachWhether to use the $each modifier.

Member Function Documentation

template<typename NvpT , typename U >
void mangrove::add_to_set_update_expr< NvpT, U >::append_to_bson ( bsoncxx::builder::core &  builder,
bool  wrap = false 
) const
inline

Appends this query to a BSON core builder as an expression '.

addToSet
{field: value | {

each: value}}'

Parameters
builderA basic BSON core builder.
wrapWhether to wrap this expression inside a document.

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