MongoDB Ex icon

MongoDB Ex

MongoDB Extended - Advanced MongoDB operations, including support for filters, bulk operations, full update JSON support and more.

Document → Delete

AI-generated

Summary

Delete documents matching a specified query from a MongoDB collection.

Inputs

  • collection (required) — MongoDB Collection
  • query (required) — MongoDB Delete query
  • options — Options for the delete operation, such as timeout, maxTimeMS, and hint.

Output shape

An object indicating the delete result (e.g., acknowledged flag and deletedCount).

May include additional metadata; on failure an error is thrown unless continueOnFail is enabled.

Examples

Example 1: Remove all documents older than 1950

collection: orders; query: {"date": {"$lt": "1950-01-01"}}; options: {}

Example 2: Delete a single document with a specific ID

collection: customers; query: {"_id": "{OBJECT_ID}"}; options: {maxTimeMS: 5000}

Discussion