[][src]Trait avocado::ops::FindAndUpdate

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

An operation for querying and updating the same document atomically, in a single step.

Associated Types

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

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

Loading content...

Required methods

fn filter(&self) -> Document

Filter for restricting documents to update or upsert.

fn update(&self) -> Document

The update or upsert to perform.

Loading content...

Provided methods

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

Optional transform applied to the 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() -> FindOneAndUpdateOptions

Options for this query-and-update operation.

Loading content...

Implementations on Foreign Types

impl<T: Doc, U: FindAndUpdate<T>, '_> FindAndUpdate<T> for &'_ U
[src]

Loading content...

Implementors

Loading content...