Go - Collection.Doc()

Get a reference to a document in the collection.

import (
  "fmt"

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

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

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

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

Parameters

  • Name
    key
    Required
    Required
    Type
    string
    Description

    The key of the document to reference.

See also