pub trait Model{
Show 19 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 aggregate<T: DeserializeOwned + Send>(
pipeline: Vec<Document>
) -> 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 aggregate<T: DeserializeOwned + Send>( pipeline: Vec<Document> ) -> Result<Vec<T>, MongooseError>
async fn create_indexes( options: &[IndexModel] ) -> Result<CreateIndexesResult, MongooseError>
Object Safety§
This trait is not object safe.