MongoDB Writer
The MongoDB Writer component writes data into a MongoDB collection. It supports multiple connection types, authentication options, SSL, and flexible save modes for handling inserts, duplicates, and updates.
Configuration Sections
The MongoDB Writer configurations are organized into the following sections:
Basic Information
Meta Information
Resource Configuration
Connection Validation
Meta Information Tab
Connection Type
Selects the MongoDB connection method. Options: Standard
, SRV
, Connection String
.
Standard
Host IP Address (*)
Host IP or hostname of the MongoDB instance. (Visible only for Standard
).
192.168.1.50
Port (*)
MongoDB port (required only for Standard
connection type).
27017
Username (*)
Username for authentication.
mongo_user
Password (*)
Password for authentication.
********
Database Name (*)
Name of the target MongoDB database.
analytics_db
Collection Name (*)
Name of the target collection.
customers
Schema File Name
Upload a Spark schema file in JSON format for data validation.
schema.json
Additional Parameters
Optional additional MongoDB connection parameters (key-value pairs).
replicaSet=rs0&authSource=admin
Enable SSL
Enables SSL for secure MongoDB connections.
true
Certificate Folder
Folder containing uploaded SSL certificates (appears only if SSL is enabled).
mongo_certs
Save Mode
Defines how data is written into the collection. Options: Append
, Ignore
, Upsert
.
Upsert
Note: Fields marked with
(*)
are mandatory.
Save Mode Options
Append
Inserts all new records into the collection.
Ignore
Skips insertion if a duplicate record already exists, leaving data unchanged. Useful for avoiding duplicates.
Upsert
Updates a record if it exists, or inserts it if it does not exist. Ensures the collection contains the latest data.
SSL Configuration
When Enable SSL is checked:
Upload SSL certificate files via Admin Settings → Certificate Upload.
Select the Certificate Folder in the component configuration.
Required SSL files:
Certificate file (
.pem
)Key file (
.key
)
Notes
SRV Connection Type automatically resolves replica sets and provides connection failover.
Ignore mode is particularly useful for deduplication scenarios.
Upsert mode is recommended for incremental updates to ensure data consistency.
Always validate schema compatibility between Spark and MongoDB to avoid runtime errors.