[−][src]Struct ejdb::query::QueryHints
A container of EJDB query options.
This structure is a wrapper around a BSON document with various options affecting query
execution in EJDB. It implements Deref<Target=bson::Document> and DerefMut, therefore
it is possible to work with it as a BSON document directly. It also has
into_bson()/as_bson() methods and Into<bson::Document>/From<bson::Document>
implementations. If an invalid document is constructed and passed as a hints map when
executing a query, an error will be returned.
Query hints are a part of any query operation and are passed with the actual query to
Collection::query() method; they can be empty if the default behavior is sufficient.
Methods
impl QueryHints[src]
pub fn new() -> QueryHints[src]
Creates a new, empty query hints set.
pub fn max(self, n: i64) -> QueryHints[src]
Sets the maximum number of entries which should be returned by the query.
Corresponds to $max hint in EJDB query hints syntax.
pub fn skip(self, n: i64) -> QueryHints[src]
Sets the number of entries which should be skipped first when query results are inspected.
Corresponds to $skip hint in EJDB query hints syntax.
pub fn order_by<S: Into<String>>(self, field: S) -> QueryHintsOrderBy[src]
Returns a builder for ordering hint for the provided field.
Corresponds to $orderBy hint in EJDB query hints syntax.
pub fn field<S: Into<String>>(self, field: S) -> QueryHintsField[src]
Returns a builder for setting inclusion/exclusion flag of the provided field.
Corresponds to $fields hint in EJDB query syntax.
pub fn into_bson(self) -> Document[src]
Converts these hints to a BSON document.
pub fn as_bson(&self) -> &Document[src]
Returns a reference to these hints as a BSON document.
pub fn as_bson_mut(&mut self) -> &mut Document[src]
Returns a mutable reference to these hints as a BSON document.
Be careful when modifying the document directly because it may lead to invalid hints.
Trait Implementations
impl PartialEq<QueryHints> for QueryHints[src]
fn eq(&self, other: &QueryHints) -> bool[src]
fn ne(&self, other: &QueryHints) -> bool[src]
impl Clone for QueryHints[src]
fn clone(&self) -> QueryHints[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl From<OrderedDocument> for QueryHints[src]
fn from(document: Document) -> QueryHints[src]
impl Into<OrderedDocument> for QueryHints[src]
impl Debug for QueryHints[src]
impl DerefMut for QueryHints[src]
impl Deref for QueryHints[src]
Auto Trait Implementations
impl Send for QueryHints
impl Sync for QueryHints
Blanket Implementations
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>, [src]
T: From<U>,
type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,