mongodb-helper 0.1.6

A mongodb helper
Documentation
use bson::Document;
use mongodb::options::UpdateOptions;

impl super::Database {
    pub fn update_many(
        &self,
        collection: &str,
        filter: Document,
        update: Document,
        options: Option<UpdateOptions>,
    ) -> Result<i64, String> {
        let collection = self.db.collection(&String::from(collection));

        match collection.update_many(filter, update, options) {
            Ok(updated) => Ok(updated.modified_count),
            Err(e) => Err(e.to_string()),
        }
    }
}