Delete
Delete documents from a DocumentDB collection.
Delete one or more documents from a DocumentDB collection that match the filter criteria.
type: "io.kestra.plugin.documentdb.Delete"Examples
Delete a single user document
id: delete_documentdb_user
namespace: company.documentdb
tasks:
- id: delete_user
type: io.kestra.plugin.documentdb.Delete
host: "https://my-documentdb-instance.com"
database: "myapp"
collection: "users"
username: "{{ secret('DOCUMENTDB_USERNAME') }}"
password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
filter:
email: "[email protected]"
deleteMany: false
Delete multiple inactive documents
id: cleanup_inactive_users
namespace: company.documentdb
tasks:
- id: delete_inactive_users
type: io.kestra.plugin.documentdb.Delete
host: "https://my-documentdb-instance.com"
database: "myapp"
collection: "users"
username: "{{ secret('DOCUMENTDB_USERNAME') }}"
password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
filter:
status: "inactive"
last_login:
$lt: "2022-01-01"
deleteMany: true
Delete documents by age criteria
id: delete_old_logs
namespace: company.documentdb
tasks:
- id: cleanup_old_logs
type: io.kestra.plugin.documentdb.Delete
host: "https://my-documentdb-instance.com"
database: "logging"
collection: "application_logs"
username: "{{ secret('DOCUMENTDB_USERNAME') }}"
password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
filter:
created_at:
$lt: "{{ now() | dateAdd(-30, 'DAYS') }}"
level:
$in: ["DEBUG", "INFO"]
deleteMany: true
Properties
collection *Requiredstring
Collection name
The name of the collection
database *Requiredstring
Database name
The name of the database
host *Requiredstring
DocumentDB host
The HTTP endpoint URL of your DocumentDB instance
password *Requiredstring
Password
DocumentDB password for authentication
username *Requiredstring
Username
DocumentDB username for authentication
deleteMany booleanstring
falseDelete multiple documents
If true, deletes all documents matching the filter (deleteMany). If false, deletes only the first match (deleteOne).
filter object
Filter criteria
MongoDB-style filter to select which documents to delete. Example: {"status": "inactive", "age": {"$gte": 18}}
Outputs
deletedCount integer
Number of documents deleted
Total count of documents that were successfully deleted