MongoDB Delete

MongoDB Delete

Certified

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.

yaml
type: io.kestra.plugin.mongodb.Delete
yaml
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

MongoDB collection

MongoDB connection properties

Definitions
uri*string

Connection string to MongoDB server

URL format like mongodb://mongodb0.example.com: 27017

MongoDB database

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.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset 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.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

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}'.

DefaultDELETE_ONE
Possible Values
DELETE_ONEDELETE_MANY

Delete operation

DELETE_ONE (default) or DELETE_MANY.

Documents deleted

Null for unacknowledged writes (w=0), which have no counts to report.

Whether the write was acknowledged

Unitcount

Number of documents deleted from the MongoDB collection