Make mongo document delete_one function return the delete count
This commit is contained in:
parent
de1eb03b13
commit
af4573fc4b
|
@ -162,15 +162,14 @@ impl Client {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
// TODO: Set true error handling
|
||||
pub async fn delete_one<T: YorokobotModel>(&self, document: Document) -> Result<(), ()> {
|
||||
pub async fn delete_one<T: YorokobotModel>(&self, document: Document) -> Result<u64, ()> {
|
||||
match self
|
||||
.get_typed_collection::<T>()
|
||||
.delete_one(document, None)
|
||||
.await
|
||||
{
|
||||
Ok(_) => Ok(()),
|
||||
Ok(result) => Ok(result.deleted_count),
|
||||
Err(_) => Err(()),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue