
DocumentDB Insert
CertifiedInsert documents into DocumentDB
DocumentDB Insert
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.
type: io.kestra.plugin.documentdb.InsertExamples
Insert a single user document
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
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
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
collection *string
Target collection
Collection inside the database where the action is performed.
database *string
Target database
Database name used for the operation; expressions are rendered at runtime.
host *string
DocumentDB endpoint
Base HTTPS endpoint for the DocumentDB REST API; trailing slash is trimmed before calling /data/v1/action/*.
password *string
HTTP password
Basic-auth password for the DocumentDB API; prefer providing via secret.
username *string
HTTP username
Basic-auth username for the DocumentDB API; prefer providing via secret.
assets
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.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset 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.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150document object
Single document payload
Document to insert when sending one record. Mutually exclusive with documents; values are rendered before execution.
documents array
Batch documents
List of documents to insert (max 10). Mutually exclusive with document; order is preserved.
Outputs
insertedCount integer
Inserted document count
Total number of documents the API reports as inserted.
insertedId string
First inserted ID
ID of the single document or the first item in a batch; null if none returned.
insertedIds array
Inserted document IDs
List of all document IDs acknowledged by DocumentDB.