Skip to main content

Overview

The OLake Go MongoDB Source connector supports multiple synchronization modes. It offers features like parallel chunking, checkpointing, and automatic resume for failed full loads. This connector can be used within the OLake UI or run locally via Docker for open-source workflows.

Sync Modes Supported​

  • Full Refresh
  • Full Refresh + Incremental
  • Full Refresh + CDC
  • CDC Only

Prerequisites​

Version Prerequisites​

MongoDB Version 4.0 or higher

CDC Prerequisites​

For Change Data Capture (CDC) mode, MongoDB must meet the following requirements:

  • MongoDB must be running in replica set mode (--replSet rs0)
  • oplog must be enabled (automatic in replica sets)
info
  1. CDC in OLake Go is not a continuous always-on process. It requires execution through the Orchestrator.

  2. If you don’t have access to enable CDC (replica sets + oplog), OLake Go also supports Incremental sync.

To set up MongoDB for CDC, please refer to the MongoDB and Atlas CDC Setup guide.

For local setup, follow MongoDB via Docker Compose.

Connection Prerequisites​

  • Read access to the tables for the MongoDB user.

After initial Prerequisites are fulfilled, the configurations for MongoDB can be configured.

Configuration​

1. Navigate to the Source Configuration Page​

  1. Complete the OLake UI Setup Guide
  2. After logging in to the OLake UI, select the Sources tab from the left sidebar.
  3. Click Create Source on the top right corner.
  4. Select MongoDB from the connector dropdown
  5. Provide a name for this source.

2. Provide Configuration Details​

  • Enter MongoDB credentials.

OLake Go MongoDB source setup form with connection and auth fields

Change data capture (CDC)​

FieldDescriptionExample Value
Enable CDCEnables change data capture to sync like inserts, updates, and deletes. When disabled, supports only Full Refresh and Incremental sync modes.Enabled (default)

Connection details​

FieldDescriptionExample Value
Hosts requiredList of MongoDB hosts. Use DNS SRV format if srv = truex.xxx.xxx.120:27017, x.xxx.xxx.133:27017 (multiple hosts supported)
Database Name requiredTarget MongoDB database name to replicatemy-db
Auth DB requiredAuthentication database name. Optional when IAM Authentication is enabled.admin-db
Username requiredMongoDB authentication username. Optional when IAM Authentication is enabled.mongo-user
Password requiredMongoDB authentication password. Optional when IAM Authentication is enabled.mongo-pwd
Replica SetName of the replica set (if applicable)rs0
Read PreferenceMongoDB read preference settingsecondaryPreferred
Use SRVEnable DNS SRV connection strings. When true, only one host allowed in hosts fieldfalse
Chunking StrategyData chunking strategy: timestamp, splitVector. Defaults to splitVector if emptysplitVector
IAM AuthenticationTurn on to use IAM credentials stored in host machine instead of Username and Passwordoff
Additional Connection ParametersAdditional MongoDB connection string parameters (e.g., authMechanism).
Each parameter will be added to the connection URI
authMechanism=SCRAM-SHA-256
SSL ModeDefines whether the connection to the database is encrypted over TLS/SSL. Needed to meet security requirements and connect to databases that do not allow plain-text traffic.
  • require
  • disable
  • verify-ca
  • verify-full

Additional configuration​

FieldDescriptionExample Value
Max ThreadsMaximum parallel threads for chunk-based snapshotting3
Retry CountNumber of retry attempts with exponential backoff.3
SSH ConfigConfigure OLake Go to connect through an SSH tunnel.
  • No Tunnel
  • SSH Key Authentication
  • SSH Password Authentication

3. Test Connection​

  • Click Set up source to validate the configuration. The test performs three checks:

    Testing Source Configuration modal showing connection success, required change_streams check, and optional oplog_retention warning with Continue anyway
    1. Connection validation: Verifies that OLake Go can reach the MongoDB deployment using the provided hosts, credentials, SSL settings, and other connection options.

    2. Required CDC prerequisites validation (when CDC is enabled): Evaluates required server-side settings to ensure reliable CDC operation:

      • change_streams: Change streams must be available
    3. Optional CDC prerequisites validation (when CDC is enabled): Evaluates optional server-side settings:

      • oplog_retention: Oplog retention must be sufficient for expected sync pauses
  • If any required check fails, the test connection will show the current and recommended values. Fix the server-side settings and retry the connection.

  • If any optional check fails, the test connection will show the current and recommended values. You can fix the server-side settings and retry, or continue and create the source without making changes.

  • If all checks pass, the MongoDB source is created successfully. Jobs can then be configured using this source.

  • In case of connection failure, refer to the Troubleshooting section.


Data Type Mapping​

MongoDB Data TypesDestination Data Type
int, timestampint
longbigint
doubledouble
booleanboolean
datetimestamptz
string, object, objectId, binData (binary), code, regex (BSONRegExp), decimal128, maxKey, minKey, array, undefinedstring
timestamptz timezone

OLake Go always ingests timestamp data in UTC format, independent of the source timezone.


Date and Time Handling​

During transfer, values in date, time, and timestamp columns are modified to ensure valid calendar ranges and destination compatibility.

  • Case I (Year 0000):
    Source dates with year 0000 are not valid in most destinations, so we change them to the epoch start date.
    Example: 0000-05-10 → 1970-01-01
  • Case II (Year > 9999):
    Extremely large years are capped at 9999. The month and date are not affected.
    Examples: 10000-03-12 → 9999-03-12
  • Case III (Invalid month/day):
    When the month or day exceeds valid ranges (i.e. month > 12 or day > 31), or the combined date is invalid, the value is replaced with the epoch start date.
    Examples: 2024-13-15 → 1970-01-01, 2023-04-31 → 1970-01-01
Note

These rules apply to date, time, and timestamp columns during transfer.


Troubleshooting​

1. Connection Failed (UI/CLI):​

Cause: Wrong host/port, MongoDB not running.

Solution: Check the port number entered is correct and MongoDB is up and accessible.

2. CDC Not Working:​

Cause: MongoDB not in replica set / oplog not accessible

Solution: Verify replica set is active by running rs.status()

3. File not found (CLI):​

Cause: Not in correct directory while running commands

Solution: Make sure both source.json is present in correct directory and the commands are executed while inside the directory

4. file name too long & FATAL error occurred while reading records: failed to finish backfill chunk 381: main writer closed:​

Cause: The generated file or directory name exceeded the Linux limit of 255 bytes (often happens when partitioning on very long string values).

bash
2025-02-17T07:03:00Z ERROR main writer closed, with error: failed to create parititon file: failed to create directories[output/otter_db/stream_8/H.

Solution: The max filename length is 255 bytes and this error shows that you have excceded that limit for file creation (might happen if you partion based on STRING field that contain values that are too large). Usually in a linux system, these limits are defined at:

bash
cat /usr/include/linux/limits.h

...
#define NAME_MAX 255 /* # chars in a file name */
#define PATH_MAX 4096 /* # chars in a path name including nul */
...

Changelog​

Date of ReleaseVersionDescription
Aug 27, 2025v0.1.11override default timeout in Discover