Go - Collection.Doc.Delete()

Delete a document from a collection.

import (
  "context"
  "fmt"

  "github.com/nitrictech/go-sdk/nitric"
)

func main() {
  profiles, err := nitric.NewCollection("profiles").With(nitric.CollectionDeleting)
  if err != nil {
    return
  }

  drakeProfileRef := profiles.Doc("Drake Mallard")

  err = drakeProfileRef.Delete(context.TODO())
  if err != nil {
    return
  }

  if err := nitric.Run(); err != nil {
    fmt.Println(err)
  }
}

Parameters

  • Name
    ctx
    Required
    Required
    Type
    context
    Description

    The context of the call, used for tracing.

See also