DocumentDB Insert

DocumentDB Insert

Certified

Insert documents into DocumentDB

Write one document or a batch (max 10) to the target collection. Rendered inputs support expressions; choose either document or documents.

yaml
type: io.kestra.plugin.documentdb.Insert

Insert a single user document

yaml
id: insert_documentdb_user
namespace: company.documentdb

tasks:
  - id: insert_user
    type: io.kestra.plugin.documentdb.Insert
    host: "https://my-documentdb-instance.com"
    database: "myapp"
    collection: "users"
    username: "{{ secret('DOCUMENTDB_USERNAME') }}"
    password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
    document:
      name: "John Doe"
      email: "john.doe@example.com"
      age: 30
      created_at: "{{ now() }}"

Insert multiple product documents

yaml
id: insert_products
namespace: company.documentdb

tasks:
  - id: insert_product_batch
    type: io.kestra.plugin.documentdb.Insert
    host: "https://my-documentdb-instance.com"
    database: "inventory"
    collection: "products"
    username: "{{ secret('DOCUMENTDB_USERNAME') }}"
    password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
    documents:
      - name: "Laptop"
        price: 999.99
        category: "Electronics"
        in_stock: true
      - name: "Mouse"
        price: 29.99
        category: "Electronics"
        in_stock: false

Insert document with dynamic data

yaml
id: insert_dynamic_order
namespace: company.documentdb

inputs:
  - id: customer_id
    type: STRING
    required: true
  - id: product_name
    type: STRING
    required: true
  - id: quantity
    type: INT
    required: true

tasks:
  - id: insert_order
    type: io.kestra.plugin.documentdb.Insert
    host: "https://my-documentdb-instance.com"
    database: "sales"
    collection: "orders"
    username: "{{ secret('DOCUMENTDB_USERNAME') }}"
    password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
    document:
      customer_id: "{{ inputs.customer_id }}"
      product: "{{ inputs.product_name }}"
      quantity: "{{ inputs.quantity }}"
      order_date: "{{ now() }}"
      status: "pending"
Properties

Target collection

Collection inside the database where the action is performed.

Target database

Database name used for the operation; expressions are rendered at runtime.

DocumentDB endpoint

Base HTTPS endpoint for the DocumentDB REST API; trailing slash is trimmed before calling /data/v1/action/*.

HTTP password

Basic-auth password for the DocumentDB API; prefer providing via secret.

HTTP username

Basic-auth username for the DocumentDB API; prefer providing via secret.

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

Single document payload

Document to insert when sending one record. Mutually exclusive with documents; values are rendered before execution.

SubTypeobject

Batch documents

List of documents to insert (max 10). Mutually exclusive with document; order is preserved.

Inserted document count

Total number of documents the API reports as inserted.

First inserted ID

ID of the single document or the first item in a batch; null if none returned.

SubTypestring

Inserted document IDs

List of all document IDs acknowledged by DocumentDB.