[][src]Trait avocado::doc::Doc

pub trait Doc: Serialize + for<'a> Deserialize<'a> {
    type Id: Eq + Serialize + for<'a> Deserialize<'a>;

    const NAME: &'static str;

    fn id(&self) -> Option<&Uid<Self>>;
fn set_id(&mut self, id: Uid<Self>); fn indexes() -> Vec<IndexModel> { ... }
fn count_options() -> CountOptions { ... }
fn distinct_options() -> DistinctOptions { ... }
fn aggregate_options() -> AggregateOptions { ... }
fn query_options() -> FindOptions { ... }
fn insert_options() -> InsertManyOptions { ... }
fn delete_options() -> WriteConcern { ... }
fn update_options() -> WriteConcern { ... }
fn upsert_options() -> WriteConcern { ... }
fn find_and_update_options() -> FindOneAndUpdateOptions { ... } }

Implemented by top-level (direct collection member) documents only. These types always have an associated top-level name and an _id field.

Associated Types

type Id: Eq + Serialize + for<'a> Deserialize<'a>

The type of the unique IDs for the document. A good default choice is ObjectId. TODO(H2CO3): make it default to ObjectId (#29661).

Loading content...

Associated Constants

const NAME: &'static str

The name of the collection within the database.

Loading content...

Required methods

fn id(&self) -> Option<&Uid<Self>>

Get the unique ID of this document if it exists.

fn set_id(&mut self, id: Uid<Self>)

Set or change the unique ID of this document.

Loading content...

Provided methods

fn indexes() -> Vec<IndexModel>

Returns the specifications of the indexes created on the collection. If not provided, returns an empty vector, leading to the collection not bearing any user-defined indexes. (The _id field will still be indexed, though, as defined by MongoDB.)

fn count_options() -> CountOptions

Options for a count-only query.

fn distinct_options() -> DistinctOptions

Options for a distinct query.

fn aggregate_options() -> AggregateOptions

Aggregation pipeline options.

fn query_options() -> FindOptions

Options for a regular query.

fn insert_options() -> InsertManyOptions

Options for single and batch insertions.

fn delete_options() -> WriteConcern

Options for a delete operation.

fn update_options() -> WriteConcern

Options for a (strictly non-upsert) update operation.

fn upsert_options() -> WriteConcern

Options for upserting.

fn find_and_update_options() -> FindOneAndUpdateOptions

Options for find-and-update operations.

Loading content...

Implementors

Loading content...