
MongoDB Delete
CertifiedDelete documents from MongoDB
MongoDB Delete
Delete documents from MongoDB
Runs deleteOne (default) or deleteMany on a collection. Filter supports BSON strings or maps rendered from Flow variables.
Failures
DELETE_MANY is not atomic: if it fails mid-write, some documents may already be deleted and the task reports no count. A retry with the same filter deletes the rest. Retry a DELETE_ONE only when its filter matches a single document, such as on _id.
type: io.kestra.plugin.mongodb.DeleteExamples
id: mongodb_delete
namespace: company.team
tasks:
- id: delete
type: io.kestra.plugin.mongodb.Delete
connection:
uri: "mongodb://root:example@localhost:27017/?authSource=admin"
database: "my_database"
collection: "my_collection"
operation: "DELETE_ONE"
filter:
_id:
$oid: 60930c39a982931c20ef6cd6
Properties
collection *string
MongoDB collection
connection *
MongoDB connection properties
io.kestra.plugin.mongodb.MongoDbConnection
Connection string to MongoDB server
URL format like mongodb://mongodb0.example.com: 27017
database *string
MongoDB database
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
{}1150filter object
Query filter
BSON string or map rendered before execution.
Required with DELETE_MANY: an empty map filter fails, set filter: '{}' (string) to delete every document in the collection.
A null map entry is dropped when the flow is parsed; pass a JSON string when a null is needed, for example '{"deletedAt": null}'.
operation string
DELETE_ONEDELETE_ONEDELETE_MANYDelete operation
DELETE_ONE (default) or DELETE_MANY.
Outputs
deletedCount integer
Documents deleted
Null for unacknowledged writes (w=0), which have no counts to report.
wasAcknowledged boolean
Whether the write was acknowledged
Metrics
deleted.count counter
countNumber of documents deleted from the MongoDB collection