Trait Model

Source
pub trait Model{
Show 20 methods // Provided methods async fn client() -> &'static Client { ... } async fn database() -> &'static Database { ... } async fn collection() -> Collection<Self> { ... } async fn create_view(source: impl ToString, pipeline: Vec<Document>) -> bool { ... } fn name() -> String { ... } fn generate_nanoid() -> String { ... } fn normalize_updates(updates: &Document) -> Document { ... } async fn save(&self) -> Result<Self, MongooseError> { ... } async fn bulk_insert( docs: &[Self], ) -> Result<InsertManyResult, MongooseError> { ... } async fn read(filter: Document) -> Result<Self, MongooseError> { ... } async fn read_by_id(id: impl ToString + Send) -> Result<Self, MongooseError> { ... } async fn list( filter: Document, options: ListOptions, ) -> Result<Vec<Self>, MongooseError> { ... } async fn update( filter: Document, updates: Document, ) -> Result<Self, MongooseError> { ... } async fn bulk_update( filter: Document, updates: Document, ) -> Result<UpdateResult, MongooseError> { ... } async fn delete(filter: Document) -> Result<DeleteResult, MongooseError> { ... } async fn bulk_delete( filter: Document, ) -> Result<DeleteResult, MongooseError> { ... } async fn count(filter: Option<Document>) -> Result<u64, MongooseError> { ... } async fn estimated_collection_count() -> Result<u64, MongooseError> { ... } async fn aggregate<T: DeserializeOwned + Send>( pipeline: Vec<Document>, options: impl Into<Option<AggregateOptions>>, ) -> Result<Vec<T>, MongooseError> { ... } async fn create_indexes( options: &[IndexModel], ) -> Result<CreateIndexesResult, MongooseError> { ... }
}

Provided Methods§

Source

async fn client() -> &'static Client

Source

async fn database() -> &'static Database

Source

async fn collection() -> Collection<Self>

Source

async fn create_view(source: impl ToString, pipeline: Vec<Document>) -> bool

Source

fn name() -> String

Source

fn generate_nanoid() -> String

Source

fn normalize_updates(updates: &Document) -> Document

Source

async fn save(&self) -> Result<Self, MongooseError>

Source

async fn bulk_insert(docs: &[Self]) -> Result<InsertManyResult, MongooseError>

Source

async fn read(filter: Document) -> Result<Self, MongooseError>

Source

async fn read_by_id(id: impl ToString + Send) -> Result<Self, MongooseError>

Source

async fn list( filter: Document, options: ListOptions, ) -> Result<Vec<Self>, MongooseError>

Source

async fn update( filter: Document, updates: Document, ) -> Result<Self, MongooseError>

Source

async fn bulk_update( filter: Document, updates: Document, ) -> Result<UpdateResult, MongooseError>

Source

async fn delete(filter: Document) -> Result<DeleteResult, MongooseError>

Source

async fn bulk_delete(filter: Document) -> Result<DeleteResult, MongooseError>

Source

async fn count(filter: Option<Document>) -> Result<u64, MongooseError>

Source

async fn estimated_collection_count() -> Result<u64, MongooseError>

Source

async fn aggregate<T: DeserializeOwned + Send>( pipeline: Vec<Document>, options: impl Into<Option<AggregateOptions>>, ) -> Result<Vec<T>, MongooseError>

Source

async fn create_indexes( options: &[IndexModel], ) -> Result<CreateIndexesResult, MongooseError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§