method

LocalAPI.UpdateWithOptions

func (local *LocalAPI) UpdateWithOptions( ctx context.Context, collection, id string, values store.Values, options MutationOptions, ) (store.Document, error)

Update one document with optimistic concurrency and response controls.

Source core/local.go:407

@param ctx
Request context.
@param collection
Authored collection slug.
@param id
Document ID.
@param values
Partial submitted field values.
@param options
Write and response options.
@returns
The authorized updated document, or an operation error.

Example

go
post, err := app.Local().UpdateWithOptions(
  ctx,
  "posts",
  postID,
  changes,
  ridu.MutationOptions{
    Actor:            actor,
    ExpectedRevision: currentRevision,
  },
)

Related types

  • LocalAPI

    In-process content operations that share the REST authorization and lifecycle pipeline.

  • Values

    A map of field names to typed values.

  • MutationOptions

    Authorization, optimistic concurrency, response population, create status, and locale controls for one write.

  • Document

    A stored document with status and version metadata.