MongoDB Delete

This Snap deletes some or all documents in a MongoDB collection.

Overview

This Snap deletes some or all documents in a MongoDB collection.


MongoDB Delete Snap in pipeline

Supported Accounts

  • This is a Write-type Snap.

Prerequisites

None.

Limitations and known issues

None.

Snap views

Type Description Examples of upstream and downstream Snaps
Input Optional. This Snap has at most one document input view.
Output Optional. This Snap has at most one document output view. The output document contains the number of documents deleted: {"deleted_documents": n}
Learn more about Error handling.

Snap settings

Field/Field set Description

Label

String
Required.Specify a unique name for the Snap. Modify this to be more appropriate, especially if there are more than one of the same Snap in the pipeline.

Default value: MongoDB - Delete

Database name

String/Suggestion

The database that the collection is defined in. If not specified, then the MongoDB account database will be used.

Default value: N/A

Example: assets

Collection name

String/Expression/ Suggestion

Required. Select or enter a MongoDB collection name.

Default value: N/A

Example: leads

Delete query

String/Expression

The delete query represents the remove query parameter. It is an expression that evaluates to an object or JSON string. If no delete query is defined, then all records will be removed from the collection. When the expression evaluates to an object, only strict mode is supported. When the expression evaluates to a JSON string, both strict mode and mongo shell mode are supported. More information about MongoDB Extended JSON can be found here.

Example: (with '=' button pressed/expression enabled)

$id represents an integer in this example.

{"id": {$lte: $id}}

or

'{"id": {$lte:' + $id + '}}'

Default value: N/A

Allow delete all

Checkbox

If this property is selected and the Delete query is empty, all documents are deleted from the selected collection.

If not selected and the Delete query property is empty, the Snap execute successfully with an output document:

{"deleted_documents": 0}

Default status: Deselected

Pass through

Checkbox

If selected, the input document will be passed through to the output views under the key 'original'. The document will be passed to the Parameter output view, and it will also be passed to the Result Set output view if there is output sent from this view.

Default status: Selected

Number of retries

Integer/Expression

Specify the maximum number of attempts to be made to receive a response. The request is terminated if the attempts do not result in a response.

Note:
  • If the Number of retries value is set to 0 (the default value), the retry option is disabled, and the Snap does not initiate a retry. The pipeline will not attempt to retry the operation in case of a failure—any failure encountered during the database operation will immediately result in the pipeline failing without any retry attempts to recover from the errors.
  • If the Snap fails on all retries, it routes the last occurred exception to the error view.

Default value: 0

Example: 4

Retry interval (seconds)

Integer/Expression

Specify the time interval between two retry requests.

Default value: 1

Example: 5

Snap execution

Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Validate & Execute

Example: Execute only

Note: The upstream schema suggest is only supported if the defined collection provides data. MongoDB does not provide a metadata API to describe the collection, so the SnapLogic platform looks at the data and derives the schema from it.