upsert 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.

upsert document v14.0.5 Updated v15.0.0

Creates or updates a document with the given GUID. If the document does not exist, it will be created. If it already exists, the mutations will be applied to the existing document.

In pins 6 + flow
  • flow
    flow
  • guid required
    value

    The GUID for this document. If a document with this GUID exists it will be updated, otherwise a new document will be created. • 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/remove/upsert set 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/new 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 or skip_on_saved to skip the on-events for this document.

  • Storage required
    storage

    The storage this document will be created in or updated.

Out pins 7 + flow
  • flow
    flow
  • success
    condition
  • guid
    value
  • object
    object
  • timestamp
    number

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

  • error
    value
  • created
    condition

    Returns true if the document was created, false if an existing document was updated.

  • has changes v15.0.0
    condition

    Returns true if the document was created or an existing document had any changes, false if an existing document was updated without any effective changes.

A typical wiring for upsert document: generate guid feeds the guid pin; branch feeds the flow pin; set fields feeds the mutations pin; the flow out pin feeds return Exposed Data; the success out pin feeds branch.

Studio canvas example for the upsert document block: typical wiring for upsert document.

Commonly used with

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

  • branch: wired in both directions with this block.
  • generate guid: feeds into this block. Generates a unique GUID. When a seed is provided, the GUID is deterministic (same seed always produces the same GUID) — the sha256 of the seed, the same derivation the document blocks apply to their guid_seed pin. Wire this output into verbatim guid pins (get / update / remove) to address seed-created documents. Never wire it into a guid_seed pin: that would hash the already-hashed value again and address a different document — give guid_seed pins the raw seed instead.
  • return Exposed Data: this block feeds into it. Adds a custom array for each iteration in ForEach, allows you to expose values back to the original flow.
  • set fields: feeds into this block. Generates an array of mutations based on the given filled fields.
  • reply in JSON: this block feeds into it. Reply to any httpconnection as JSON body.
  • multiple: feeds into this block. combine multiple mutations into one.

Version history

Introduced in v14.0.5.

Last modified in v15.0.0.


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