
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 *Requiredstring
Target collection
Collection inside the database where the action is performed.
database *Requiredstring
Target database
Database name used for the operation; expressions are rendered at runtime.
host *Requiredstring
DocumentDB endpoint
Base HTTPS endpoint for the DocumentDB REST API; trailing slash is trimmed before calling /data/v1/action/*.
password *Requiredstring
HTTP password
Basic-auth password for the DocumentDB API; prefer providing via secret.
username *Requiredstring
HTTP username
Basic-auth username for the DocumentDB API; prefer providing via secret.
document 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.
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
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.