Mangrove
The C++ Object Document Mapper for MongoDB
Public Member Functions | List of all members
mangrove::nvp_child< Base, T, Parent > Class Template Reference

Class that represents a name-value pair for a field of an object that is a member of another object. More...

#include <nvp.hpp>

+ Inheritance diagram for mangrove::nvp_child< Base, T, Parent >:

Public Member Functions

constexpr update_expr< nvp_child< Base, T, Parent >, T > operator= (const no_opt_type &val) const
 Creates an update expression that sets the field to the given value.
 
template<typename U = no_opt_type>
constexpr std::enable_if_t< is_date_v< U >, current_date_expr< nvp_child > > operator= (const current_date_t &) const
 Creates an expression that sets a date value to the current date. More...
 
template<typename U = no_opt_type>
constexpr std::enable_if_t< std::is_same< bsoncxx::types::b_timestamp, U >::value, current_date_expr< nvp_child > > operator= (const current_date_t &) const
 Creates an expression that sets a date value to the current date. More...
 
std::string get_name () const
 Returns the name of this field, in dot notation. More...
 
std::string & append_name (std::string &s) const
 Returns the qualified name of this field in dot notation, i.e. More...
 
- Public Member Functions inherited from mangrove::nvp_base< nvp_child< Base, T, Parent >, T >
constexpr nvp_child< iterable_value_t< no_opt_type >, U, nvp_child< Base, T, Parent > > operator->* (const nvp< iterable_value_t< no_opt_type >, U > &child) const
 Chains two name-value pairs to access a sub-field, i.e. More...
 
constexpr sort_expr< nvp_child< Base, T, Parent > > sort (bool ascending) const
 Creates a sort expression that sorts documents by this field. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, Iterable > in (const Iterable &iter) const
 Creates an expression that checks whether the value of this field matches any value in the given iterable. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, Iterable > nin (const Iterable &iter) const
 Creates an expression that checks whether the value of this field matches none of the values in the given iterable. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, bool > exists (const bool &exists) const
 Creates an expression that checks the existence of a certain field. More...
 
constexpr mod_expr< nvp_child< Base, T, Parent > > mod (const int &divisor, const int &remainder) const
 Creates a mod_expr that represents a query with the $mod operator. More...
 
constexpr comparison_value_expr< nvp_child< Base, T, Parent >, bsoncxx::types::b_regex > regex (const char *regex, const char *options) const
 Creates a comparison expression that represents a query with a $regex operator. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, Iterable > all (const Iterable &iter) const
 Creates a query with the $all operator that compares values in this field's array to values in another array. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, Expr > elem_match (const Expr &queries) const
 Creates a query with the $elemMatch operator that finds elements in this field that match the given queries. More...
 
constexpr free_nvp< iterable_value_t< no_opt_type > > element () const
 Constructs a nameless name-value-pair that corresponds to an element in a scalar array, if this field is an array. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, std::int64_t > size (const std::int64_t &n) const
 Creates an array query expression with the $size operator. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, Mask > bits_all_set (const Mask &bitmask) const
 Creates a query that uses the $bitsAllSet operator to check a numerical field with a bitmask. More...
 
constexpr comparison_value_expr< nvp_child< Base, T, Parent >, std::int64_t > bits_all_set (std::int64_t pos1, std::int64_t pos2, Args...positions) const
 Creates a query that uses the $bitsAllSet operator to check a series of bits, given as bit positions. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, Mask > bits_any_set (const Mask &bitmask) const
 Creates a query that uses the $bitsAnySet operator to check a numerical field with a bitmask. More...
 
constexpr comparison_value_expr< nvp_child< Base, T, Parent >, std::int64_t > bits_any_set (std::int64_t pos1, std::int64_t pos2, Args...positions) const
 Creates a query that uses the $bitsAnySet operator to check a series of bits, given as bit positions. More...
 
constexpr comparison_value_expr< nvp_child< Base, T, Parent >, Mask > bits_all_clear (const Mask &bitmask) const
 Creates a query that uses the $bitsAllClear operator to check a numerical field with a bitmask. More...
 
constexpr comparison_value_expr< nvp_child< Base, T, Parent >, std::int64_t > bits_all_clear (std::int64_t pos1, std::int64_t pos2, Args...positions) const
 Creates a query that uses the $bitsAllClear operator to check a series of bits, given as bit positions. More...
 
constexpr comparison_expr< nvp_child< Base, T, Parent >, Mask > bits_any_clear (const Mask &bitmask) const
 Creates a query that uses the $bitsAnyClear operator to check a numerical field with a bitmask. More...
 
constexpr comparison_value_expr< nvp_child< Base, T, Parent >, std::int64_t > bits_any_clear (std::int64_t pos1, std::int64_t pos2, Args...positions) const
 Creates a query that uses the $bitsAnyClear operator to check a series of bits, given as bit positions. More...
 
constexpr unset_expr< nvp_child< Base, T, Parent > > unset () const
 Creates an expression that unsets the current field. More...
 
constexpr update_expr< nvp_child< Base, T, Parent >, no_opt_type > min (const no_opt_type &val) const
 Creates an expression that uses the $min operator to only update a field if the new value is lower than the current value. More...
 
constexpr update_expr< nvp_child< Base, T, Parent >, no_opt_type > max (const no_opt_type &val) const
 Creates an expression that uses the $max operator to only update a field if the new value is greater than the current value. More...
 
constexpr dollar_operator_nvp< nvp_child< Base, T, Parent > > first_match () const
 Returns a name-value pair with the $ operator appended to it. More...
 
constexpr update_value_expr< nvp_child< Base, T, Parent >, int > pop (bool last) const
 Creates an update expression with the $pop operator. More...
 
constexpr update_expr< nvp_child< Base, T, Parent >, iterable_value_t< no_opt_type > > pull (const iterable_value_t< no_opt_type > &val) const
 Creates an update expression with the $pull operator, that removes an element if it matches the given value exactly. More...
 
constexpr std::enable_if_t< details::is_query_expression_v< Expr >, update_expr< nvp_child< Base, T, Parent >, Expr > > pull (const Expr &expr) const
 Creates an update expression with the $pull operator, that removes an element if it matches the given query. More...
 
constexpr update_expr< nvp_child< Base, T, Parent >, Iterable > pull_all (const Iterable &iter) const
 Creates an update expression with the $pull operator, that removes an element if it matches the given value exactly. More...
 
constexpr add_to_set_update_expr< nvp_child< Base, T, Parent >, iterable_value_t< no_opt_type > > add_to_set (const iterable_value_t< no_opt_type > &val) const
 Creates an update expression with the $addToSet operator, that adds a single value to an array, if it is unique. More...
 
constexpr add_to_set_update_expr< nvp_child< Base, T, Parent >, Iterable > add_to_set (const Iterable &iter) const
 Creates an update expression with the $addToSet operator and the $each modifier, that adds a list of value to an array, only keeping the unique values. More...
 
constexpr push_update_expr< nvp_child< Base, T, Parent >, iterable_value_t< no_opt_type > > push (const iterable_value_t< no_opt_type > &val) const
 Creates an update epxression with the $push operator, that adds a single value to an array. More...
 
constexpr push_update_expr< nvp_child< Base, T, Parent >, Iterable, Sort > push (const Iterable &iter, bsoncxx::stdx::optional< std::int32_t > slice=bsoncxx::stdx::nullopt, const bsoncxx::stdx::optional< Sort > &sort=bsoncxx::stdx::nullopt, bsoncxx::stdx::optional< std::uint32_t > position=bsoncxx::stdx::nullopt) const
 Creates an update epxression with the $push operator and the $each modifier, that adds a list of value to an array. More...
 

Detailed Description

template<typename Base, typename T, typename Parent>
class mangrove::nvp_child< Base, T, Parent >

Class that represents a name-value pair for a field of an object that is a member of another object.

The name of this name-value pair will be "<parent-name>.field_name". The parenet can be either an nvp, or another nvp_child.

Template Parameters
BaseThe type of the object that contains this field
TThe type of the field
ParentThe type of the parent name-value pair, either an nvp<...> or nvp_child<...>.

Member Function Documentation

template<typename Base , typename T , typename Parent >
std::string& mangrove::nvp_child< Base, T, Parent >::append_name ( std::string &  s) const
inline

Returns the qualified name of this field in dot notation, i.e.

"parent.child".

Returns
A string containing the name of this field in dot notation.
template<typename Base , typename T , typename Parent >
std::string mangrove::nvp_child< Base, T, Parent >::get_name ( ) const
inline

Returns the name of this field, in dot notation.

Returns
The fully qualified name of this field in dot notation.
template<typename Base , typename T , typename Parent >
template<typename U = no_opt_type>
constexpr std::enable_if_t<is_date_v<U>, current_date_expr<nvp_child> > mangrove::nvp_child< Base, T, Parent >::operator= ( const current_date_t ) const
inline

Creates an expression that sets a date value to the current date.

This is only enabled for std::chrono::time/duration values, as well as b_date.

template<typename Base , typename T , typename Parent >
template<typename U = no_opt_type>
constexpr std::enable_if_t<std::is_same<bsoncxx::types::b_timestamp, U>::value, current_date_expr<nvp_child> > mangrove::nvp_child< Base, T, Parent >::operator= ( const current_date_t ) const
inline

Creates an expression that sets a date value to the current date.

This is only enabled for std::chrono::time/duration values, as well as b_date.


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