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.

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.

Reference (ref) of the pluginDefaults to apply to this task.

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.