Sanity · Arazzo Workflow
Sanity Upsert Document
Version 1.0.0
Find a document by a GROQ key match and patch it, otherwise create it.
View Spec
View on GitHub
Headless CMSContent ManagementGROQReal-TimeStructured ContentDeveloper PlatformArazzoWorkflows
Provider
Workflows
upsert-document
Upsert a document keyed on a GROQ field match within a dataset.
Looks for an existing document where the key field matches the supplied value and either patches the matched document or creates a new one carrying the key and fields.
1
findDocument
queryDocumentsPost
Search the dataset for a document of the given type whose key field equals the supplied value, returning the first match's id.
2
patchExisting
mutateDocuments
Patch the matched document with the supplied fields, leaving other fields untouched.
3
createNew
mutateDocuments
Create a new document of the given type carrying the key value and the supplied fields when no existing document matched.