View on GitHub
ejpp
Embedded JSON Database engine for C++11/14
Classes | Public Member Functions | Friends | List of all members
ejdb::query Struct Referencefinal

Class representing an EJDB query. More...

#include <ejdb.hpp>

Public Member Functions

 query () noexcept=default
 Default constructor. Results in an invalid query, not associated with a db.
 
 operator bool () const noexcept
 Returns whether the associated ejdb::db and represented EJDB query are both valid.
 
queryoperator&= (const std::vector< char > &)&
 In-place $and operator. More...
 
query && operator&= (const std::vector< char > &)&&
 In-place $and operator. More...
 
queryoperator&= (query)&noexcept
 In-place $and operator. More...
 
query && operator&= (query)&&noexcept
 In-place $and operator. More...
 
queryoperator|= (const std::vector< char > &)&
 In-place $or operator with BSON document as operand. More...
 
query && operator|= (const std::vector< char > &)&&
 In-place $or operator with BSON document as operand. Rvalue overload.
 
queryoperator|= (query)&noexcept
 In-place $or operator with ejdb::query as operand. More...
 
query && operator|= (query)&&noexcept
 In-place $or operator with ejdb::query as operand. Rvalue overload. More...
 
queryset_hints (const std::vector< char > &)&
 Sets hints for a query. More...
 
query && set_hints (const std::vector< char > &)&&
 Sets hints for a query. More...
 

Friends

struct collection
 
struct db
 

Detailed Description

Class representing an EJDB query.

Valid queries can only be created via ejdb::db::create_query.

Should the parent ejdb::db object expire before the query, all operations performed on or with the query will fail, with any std::error_codes set to std::errc::operation_not_permitted (EPERM). The parent ejdb::db object is guaranteed to stay alive for the duration of an operation.

Member Function Documentation

query& ejdb::query::operator&= ( const std::vector< char > &  )

In-place $and operator.

Warning
Unimplemented.
query&& ejdb::query::operator&= ( const std::vector< char > &  )

In-place $and operator.

Warning
Unimplemented.
query& ejdb::query::operator&= ( query  )
noexcept

In-place $and operator.

Warning
Unimplemented.
query&& ejdb::query::operator&= ( query  )
noexcept

In-place $and operator.

Warning
Unimplemented.
query && ejdb::query::operator|= ( const std::vector< char > &  obj)

In-place $or operator with BSON document as operand.

Exceptions
std::system_errorwith std::errc::operation_not_permitted when query is null.
query& ejdb::query::operator|= ( query  )
noexcept

In-place $or operator with ejdb::query as operand.

Warning
Unimplemented.
query&& ejdb::query::operator|= ( query  )
noexcept

In-place $or operator with ejdb::query as operand. Rvalue overload.

Warning
Unimplemented.
query && ejdb::query::set_hints ( const std::vector< char > &  obj)

Sets hints for a query.

EJDB's hints documentation follows.

Available hints:

  • $max Maximum number in the result set
  • $skip Number of skipped results in the result set
  • $orderby Sorting order of query fields.
  • $fields Set subset of fetched fields If a field presented in $orderby clause it will be forced to include in resulting records. Example:
    {
    "$orderby" : { //ORDER BY field1 ASC, field2 DESC
    "field1" : 1,
    "field2" : -1
    },
    "$fields" : { //SELECT ONLY {_id, field1, field2}
    "field1" : 1,
    "field2" : 1
    }
    }
query&& ejdb::query::set_hints ( const std::vector< char > &  )

Sets hints for a query.

EJDB's hints documentation follows.

Available hints:

  • $max Maximum number in the result set
  • $skip Number of skipped results in the result set
  • $orderby Sorting order of query fields.
  • $fields Set subset of fetched fields If a field presented in $orderby clause it will be forced to include in resulting records. Example:
    {
    "$orderby" : { //ORDER BY field1 ASC, field2 DESC
    "field1" : 1,
    "field2" : -1
    },
    "$fields" : { //SELECT ONLY {_id, field1, field2}
    "field1" : 1,
    "field2" : 1
    }
    }

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