MongoDB - Insert

MongoDB - Insert

This page is no longer maintained (May 13, 2026). For the most current information, go to MongoDB - Insert


On this Page

Snap type:

Write

Description:

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.

Prerequisites:

[None]

Support and limitations:

  • Works in Ultra Tasks if batch size is set to 1.

  • 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.

Account: 

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See MongoDB Account for information on setting up this type of account.

Views:

Input

This Snap has exactly one document input view. The input document will be inserted into the database.

Output

This Snap has no output view.

This Snap has at most on document output view.

Error

This Snap has at most one document error view and produces zero or more documents in the view.

Settings

Label

 

Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

Database name

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

Example: assets
Default value: [None] 

Collection name

 

 

Required. MongoDB collection name to execute insert on.

Example: users
Default value: [None]

Batch Size

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

Example: 10
Default value:  1

Pass through

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 value:  Selected

Number of retries

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.

  • 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 Value0
Example: 4

Retry interval (seconds)

Specify the time interval between two retry requests.

Default Value: 1
Example: 5

 

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.  

Example 


In this example, the documents are inserted into a collection using the MongoDB Insert Snap. The documents are passed using the upstream JSON Generator Snap and the Mapper Snap respectively.

The JSON Generator Snap passes the documents to be inserted into the MongoDB collection.

The Mapper Snap maps the input documents to the database collection.

The MongoDB Insert Snap inserts the documents into the collection 'test collection'.

The successful execution of the pipeline displays the below output preview: