[][src]Trait avocado::ops::Query

pub trait Query<T: Doc>: Debug {
    type Output: for<'a> Deserialize<'a>;
    fn filter(&self) -> Document { ... }
fn transform(raw: Document) -> Result<Bson> { ... }
fn options() -> FindOptions { ... } }

A regular query (find_one() or find_many()) operation.

Associated Types

type Output: for<'a> Deserialize<'a>

The type of the results obtained by executing the query. Often it's just the document type, T. TODO(H2CO3): make it default to T (#29661).

Loading content...

Provided methods

fn filter(&self) -> Document

Filter for restricting returned values. Defaults to an empty filter, resulting in all documents of the collection being returned.

fn transform(raw: Document) -> Result<Bson>

Optional transform applied to each returned raw document. Can be used to adjust the structure of the loosely-typed data so that it fits what is expected by <Self::Output as Deserialize>::deserialize().

The default implementation just returns its argument verbatim.

fn options() -> FindOptions

Options for this query.

Loading content...

Implementations on Foreign Types

impl<T: Doc, Q: Query<T>, '_> Query<T> for &'_ Q
[src]

Loading content...

Implementors

impl<T: Doc> Query<T> for Document
[src]

Loading content...