use std::collections::HashMap;
use bson::{Bson, Document};
#[derive(Debug)]
pub struct InsertOneResult {
pub inserted_id: Bson,
}
impl InsertOneResult {
pub(crate) fn from_insert_many_result(result: InsertManyResult) -> Self {
Self {
inserted_id: result
.inserted_ids
.get(&0)
.cloned()
.unwrap_or_else(|| Bson::Null),
}
}
}
#[derive(Debug)]
pub struct InsertManyResult {
pub inserted_ids: HashMap<usize, Bson>,
}
impl InsertManyResult {
pub(crate) fn new() -> Self {
InsertManyResult {
inserted_ids: HashMap::new(),
}
}
}
#[derive(Debug)]
pub struct UpdateResult {
pub matched_count: i64,
pub modified_count: i64,
pub upserted_id: Option<Bson>,
}
#[derive(Debug)]
pub struct DeleteResult {
pub deleted_count: i64,
}
#[derive(Debug)]
pub(crate) struct GetMoreResult {
pub(crate) batch: Vec<Document>,
pub(crate) exhausted: bool,
}