method

AdminLoadContext.Find

Read one saved document as the current admin user.

Example

go
post, err := ctx.Find(
  "posts",
  ctx.RouteParams["document"],
  ridu.FindOptions{},
)

Arguments

ArgumentTypeDescription
collectionstringCollection slug containing the document.
idstringID of the saved document.
optionsFindOptionsSelection and population settings. Identity and locale come from the request.

Returns

The access-filtered document, or an error such as denied or not found.

(store.Document, error)

How it works

Uses the normal content operation with the request's permissions, field redaction, hooks, and content locale. Return the error from your loader so the admin can offer retry.

Full signature

func (ctx AdminLoadContext) Find( collection, id string, options FindOptions, ) (store.Document, error)

Source core/admin_loader.go:62

Related types

  • AdminLoadContext

    Read content for the signed-in user while a Go admin loader runs.

  • FindOptions

    Projection, population, authorization, draft, trash, and locale controls for one read.

  • Document

    A stored document with status and version metadata.

Related guides