Skip to content

Instantly share code, notes, and snippets.

@sedataktas
Created December 27, 2020 15:28
Show Gist options
  • Select an option

  • Save sedataktas/3f72ff6cdeab67c204517d5468e6b4a6 to your computer and use it in GitHub Desktop.

Select an option

Save sedataktas/3f72ff6cdeab67c204517d5468e6b4a6 to your computer and use it in GitHub Desktop.
DeleteBook in mongodb with golang
func DeleteBook(id primitive.ObjectID) error {
_, err := BooksCollection.DeleteOne(Ctx, bson.D{{"_id", id}})
if err != nil {
return err
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment