From af4573fc4be075d5d77fc9352d794833c3879d03 Mon Sep 17 00:00:00 2001 From: Victor Mignot Date: Mon, 13 Feb 2023 00:01:06 +0100 Subject: [PATCH] Make mongo document delete_one function return the delete count --- src/database/client.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/database/client.rs b/src/database/client.rs index b41acf0..1764ea0 100644 --- a/src/database/client.rs +++ b/src/database/client.rs @@ -162,15 +162,14 @@ impl Client { } } - #[allow(dead_code)] // TODO: Set true error handling - pub async fn delete_one(&self, document: Document) -> Result<(), ()> { + pub async fn delete_one(&self, document: Document) -> Result { match self .get_typed_collection::() .delete_one(document, None) .await { - Ok(_) => Ok(()), + Ok(result) => Ok(result.deleted_count), Err(_) => Err(()), } }