method

HookContext.Candidate

Candidate returns the values the document will have once this write is saved: Original's values with each top-level entry of Data in their place. On a create it is a copy of Data. Use it to read a field whether or not the caller sent it, for example to check a rule that spans two fields on a partial update. The map is a detached copy; change Data, not the result, to change what is saved.

Returns

The declared result.

store.Values

Full signature

Related types

  • HookContext

    HookContext supplies the request, values, and local API to a collection or global hook. Change entries in Data before saving, or values in Document to change the response after saving. A Hook returns only an error.

  • Values

    A map of field names to typed values.