update document

This block is part of the storage group and was last modified in core v15.0.0.

Storage Selection Required

This block relies on a storage to perform its storage releated actions. You must manually select the storage you want to use in your flow using the storage selector modal. To access the modal, click the white button on the block.

update document v9.2.5 Updated v15.0.0

Update document in the given storage and creates a revision for it.

In pins 7 + flow
  • flow
    flow
  • guid required v9.2.5
    value

    The documents GUID (unique ID) to update. • Hidden when other fields are filled

  • GUID seed v15.0.0
    value

    Optional fallback when guid is not connected: derives the document GUID from this seed exactly like create document's guid_seed (the sha256 of the seed), so a create/update pair wired to the same raw seed always addresses the same document. Always wire the RAW seed : never the output of the generate guid block, which is already a hash and would be hashed again. • Hidden when other fields are filled

  • mutations required
    mutations

    Provide the mutations for this document. e.g. use set fields to set existing/update fields.

  • expiry
    date

    When a document is given an expiry date, the document will be unrecoverably deleted on the given date

  • options
    object

    Options can be given e.g. skip_revisions to skip create revisions for high-update docs, skip_on_saved to skip the on-events for this document update, skip_removed to skip removed document checks.

  • update priority v13.0.6
    number

    A document update can be important for search relevance or not, by poviding the system a priority you can help it understand what updates are high priority (1) and what updates can be delayed without huge impact for search relevance (3). 1 is highest priority, 2 is medium priority, 3 is low priority and 0 is wait-for-insert.

    Default 1

  • Storage required
    storage

    The storage this document is currently stored in.

Out pins 6 + flow
  • flow
    flow
  • success
    condition
  • guid
    value
  • document
    object
  • timestamp v12.0.0
    number

    timestamp in ms, can be used to wait for the document to be available in search.

  • error
    value
  • has changes v13.0.9
    condition

    Returns true if the document had any changes, as the block can return success for non-updated documents due to the happy flow.

Applies the mutations to the document addressed by guid : falling back to guid_seed (sha256 of the raw seed, same as create document) and then to the deprecated object pin's _meta.guid : and outputs the updated document, its guid, and timestamp in ms. No resolvable GUID gives error MISSING_GUID; missing storage MISSING_STORAGE; a failed update gives success=false, an empty object and timestamp=-1. has_changes=false when the update succeeded but effectively changed nothing, so success=true does not imply a modification. Simulation applies the mutations in memory and reports success without writing.

The flow loads a document with get document, reads a field with get fields, turns it into mutations with set fields, and update document writes them back. The success pin then drives a branch.

Studio canvas example for the update document block: writing mutations back to a document.

Commonly used with

In production blueprints, this block is most often wired together with:

  • branch: wired in both directions with this block.
  • set fields: feeds into this block. Generates an array of mutations based on the given filled fields.
  • get fields: wired in both directions with this block. Gets the selected fields from the given object.
  • reply in JSON: this block feeds into it. Reply to any httpconnection as JSON body.
  • get document: feeds into this block. get a specific document based on the given GUID.
  • create: feeds into this block. Creates a new function that can be executed using the given name.

Used in these guides

These documentation pages use or explain this block:

Version history

Introduced in v9.2.5.

Last modified in v15.0.0.

v13.0.9 This block or one of its pins was updated in v13.0.9, click here to see the release notes. v13.0.6 This block or one of its pins was updated in v13.0.6, click here to see the release notes. v12.0.0 This block or one of its pins was updated in v12.0.0, click here to see the release notes. v10.2.9 This block or one of its pins was updated in v10.2.9, click here to see the release notes.
Back to storage Return to the main group to view all sub-groups Back to storage Return to the group to view all blocks within this group