MongoDB Insert

This Snap executes a MongoDB insert command to insert input documents into the database.

Overview

This Snap executes a MongoDB insert command. Input documents will be inserted into the database. DateTime objects will be converted to UTC time zone by MongoDB, so the original timezone will be lost when inserting the object.


MongoDB Insert Snap in pipeline

Supported Accounts

  • This is a Write-type Snap.
  • Works in Ultra Tasks when the Batch size is set to 1.

Prerequisites

None.

Limitations

  • If you have a number in Decimal128 data type, the Snap inserts the number as a 64-bit floating-point value instead of a 128-bit floating-point value. As a result of this limitation, you may lose precision for values whose representation requires a 128-bit floating-point value.

Known issues

None.

Snap views

Type Description Examples of upstream and downstream Snaps
Input This Snap has exactly one document input view. The input document will be inserted into the database.
Output Optional. This Snap has at most one document output view.
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 - Insert

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/Suggestion

Required. MongoDB collection name to execute insert on.

Default value: N/A

Example: users

Batch Size

Integer

Required. Number of documents to be inserted at a time.

Default value: 1

Example: 10

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: Execute only

Example: Validate & Execute

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.