use mongodb::bson::oid::ObjectId;
pub(crate) fn parse_object_id(id: &str) -> Result<ObjectId, mongodb::error::Error> {
ObjectId::parse_str(id).map_err(|e| mongodb::error::Error::custom(e))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_parse_object_id_valid() {
let result = parse_object_id("507f1f77bcf86cd799439011");
assert!(result.is_ok());
}
#[test]
fn test_parse_object_id_invalid() {
let result = parse_object_id("invalid");
assert!(result.is_err());
}
}