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§
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>
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.