Skip to main content
MongoDB

MongoDB - Delete one document

MongoDB - Delete one document

Deletes the first document in a MongoDB collection that matches the given filter.


Options

Collection

Reference to the MongoDB: Select collection action the deletion will run on.

Filter (query)

Filter identifying the document to delete, for example { "_id": "64abc123" }.

Transaction (optional)

Reference to a MongoDB: Start transaction action when the operation must run inside a transaction. Optional field, available under the advanced options.

Returns

Javascript code

js
actions["action-id"].deleted // true if the document was deleted, false otherwise (Any)

Field selection

  • deleted — true if the document was deleted, false otherwise (Any)

Rules and Conditions

  • The Collection and Filter fields are required.
  • Only the first document matching the filter is deleted.
  • If no document matches the filter, nothing is deleted.