# MongoDB Delete

## ![](/files/17qU5gOVd9qu26Lqr5xm) MongoDB Delete

### Description <a href="#description" id="description"></a>

The MongoDB Delete transform enables you to delete [documents](http://docs.mongodb.org/manual/reference/glossary/) or [records](http://docs.mongodb.org/manual/reference/glossary/) from a collection within MongoDB.

For additional information about MongoDB, see the MongoDB [documentation](http://www.mongodb.org/).

| Hop Engine | <sup>✓</sup> |
| ---------- | ------------ |
| Spark      | <sup>✓</sup> |
| Flink      | <sup>✓</sup> |
| Dataflow   | <sup>✓</sup> |

### Options

#### General

Transform name : Specify the unique name of the MongoDB Input transform in the pipeline.

#### Delete options tab

|                                           |                                                                                                                                                     |
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Field                                     | Description                                                                                                                                         |
| MongoDB connection                        | The [MongoDB connection](/data-shaper-1.21/knowing-the-data-shaper-designer/index-2/mongodb-connection.md) to use for the MongoDB Delete transform. |
| Collection                                | Name of the collection to delete data from. Click Get collections to populate the drop-down menu with a list of collections within the database.    |
| Number of retries for write operations    | The number of retries for write operations                                                                                                          |
| Delay (in seconds) between retry attempts | Delay (in seconds) between retry attempts                                                                                                           |

#### Delete query

* use JSON query:
  * when disabled (default), the transform deletes documents based on key/value pair comparisons. The table requires the following fields:
    * Mongo document path: the document path to delete
    * Comparator: `=`,`<>`,`,`,`<`,`⇐`,`>`,`>=`,`BETWEEN`,`IS NULL`,`IS NOT NULL`
    * Incoming field 1: a first comparison stream field
    * Incoming fields 2: a second comparison stream field (for use with `BETWEEN`)
  * when enabled:
    * a delete query is passed to MongoDB for deletion.
    * execute for each row: pass the delete query to the database for each incoming row

#### Delete query examples:

Delete based on document paths and stream fields (`use JSON query` disabled):

|                     |            |                  |                  |
| ------------------- | ---------- | ---------------- | ---------------- |
| Mongo document path | Comparator | Incoming field 1 | Incoming field 2 |
| name                | =          | lastname         |                  |
| firstname           | =          | firstname        |                  |

Delete based on JSON query (`use JSON query` enabled):

```highlight
`{$or: [{"name": "${NAME1}"},{"name": "${NAME2}"}, {"name": "${NAME3}"} ]}`
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/mongodbdelete.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
