Skip to content

Instantly share code, notes, and snippets.

@gdhuper
Created April 22, 2020 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdhuper/57f5f41433c63b48c131b26b72c83403 to your computer and use it in GitHub Desktop.
Save gdhuper/57f5f41433c63b48c131b26b72c83403 to your computer and use it in GitHub Desktop.
cosmos-rust-getting-started-db-update
fn update(&self, filter: Document, update: Document) -> Result<Option<i64>, Error> {
   let collection = &self
      .client
      .get_db(&self.database)
      .get_collection(&self.collection);
   match collection.update_one(filter, update, None) {
      Ok(result) => Ok(Some(result.modified_count)),
      Err(e) => Err(e),
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment