MongoDB Writer

The MongoDB Writer task is used to write data into a MongoDB collection, supporting multiple connection types and save modes to handle diverse ingestion scenarios.

Prerequisites

  • A running MongoDB instance or cluster accessible from your environment.

  • Appropriate user credentials with write permissions on the target database and collection.

  • Knowledge of the connection type and the database/collection where data will be written.

Configuring the Meta Information Tab

To configure the MongoDB Writer:

  1. Drag the MongoDB Writer task to the Workspace.

  2. Click on the task to open its configuration tabs.

  3. The Meta Information tab opens by default. Configure the following fields:

Field
Description

Connection Type

Select from the drop-down: Standard, SRV, or Connection String.

Port

Provide the MongoDB port (default: 27017). Appears only when Standard is selected.

Host IP Address

Enter the IP address or hostname of the MongoDB server.

Username

Provide the MongoDB username with write access.

Password

Provide the corresponding password for authentication.

Database Name

Name of the MongoDB database where data will be written.

Additional Parameters

Supply any additional MongoDB connection parameters (e.g., authSource=admin, ssl=true).

Schema File Name

Upload a Spark schema file in JSON format to enforce the schema for data being written.

Save Mode

Select how the writer should persist data: <ul><li>Append — Add new documents to the target collection.</li><li>Ignore — Skip inserting records if duplicates already exist. Useful for preventing duplicate entries.</li><li>Upsert — Update existing records with new values or insert them if they do not exist.</li></ul>

Save & Next Steps

  • After configuration, click Save Task In Storage to persist your MongoDB Writer settings.

  • Run a test write with a small dataset to confirm connectivity, authentication, and schema alignment.

  • Monitor logs to ensure successful data ingestion and handle any authentication or schema errors.