diff --git a/src/model/mod.rs b/src/model/mod.rs index 520a517..1cfa7dc 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -1,4 +1,5 @@ use mongodb::{ + bson::doc, options::{FindOneOptions, FindOptions}, results::{DeleteResult, InsertOneResult}, }; @@ -175,6 +176,20 @@ pub trait Model: } } + /// Get all `Model`s from the database + #[must_use] + fn find_all() -> impl std::future::Future>> { + Self::find(doc! {}, None) + } + + /// Get all `Model`s partial from the database + #[must_use] + fn find_all_partial( + part: serde_json::Value, + ) -> impl std::future::Future>> { + Self::find_partial(doc! {}, part, None) + } + /// Get multiple `Model`s by using a filter from the database. Pass a `limit` parameter to limit the amount of `Model`s returned. #[must_use] fn find(