use bson::Document;
use mongodb::options::DeleteOptions;
impl super::Database {
pub fn delete_many(
&self,
collection: &str,
filter: Document,
write_concern: Option<DeleteOptions>,
) -> Result<i64, String> {
let collection = self.db.collection(&String::from(collection));
match collection.delete_many(filter, write_concern) {
Ok(deleted) => Ok(deleted.deleted_count),
Err(e) => Err(e.to_string()),
}
}
}