![]() |
Mangrove
The C++ Object Document Mapper for MongoDB
|
An expression that represents a sorting order. More...
#include <query_builder.hpp>
Public Member Functions | |
constexpr | sort_expr (const NvpT &nvp, bool ascending) |
Creates a sort expression with the given name-value-pair and sort order. More... | |
void | append_to_bson (bsoncxx::builder::core &builder, bool wrap=false) const |
Appends this expression to a BSON core builder, as a key-value pair of the form "key: +/-1". More... | |
operator bsoncxx::document::view_or_value () const | |
Converts the expression to a BSON filter for a query. More... | |
An expression that represents a sorting order.
This consists of a name-value pair and a boolean specifying ascending or descending sort order. The resulting BSON is {field: +/-1}, where +/-1 corresponds to the sort order.
|
inline |
Creates a sort expression with the given name-value-pair and sort order.
nvp | The name-value pair to order against. |
ascending | Whether to use ascending (true) or descending (false) order. |
|
inline |
Appends this expression to a BSON core builder, as a key-value pair of the form "key: +/-1".
builder | A BSON core builder |
wrap | Whether to wrap the BSON inside a document. |
|
inline |
Converts the expression to a BSON filter for a query.
The resulting BSON is of the form "{key: +/-1}"