This connector is intended for advanced realtime ingestion designs where the MongoDB source namespaces, partitioning, credentials, and replay window are explicitly managed. If you only need to consume Debezium-formatted MongoDB events from Kafka, use the Debezium decoder instead.
How It Works
The connector maps each configured MongoDB source partition to one Pinot partition group:mongos can fan out to every shard. Plan closer to:
Source-Partition Contract
MongoDB Change Streams do not expose Kafka-style durable partitions. The connector therefore requires a manifest of physical, disjoint MongoDB namespaces. Follow these rules:- Partition IDs are dense, stable integers:
0,1,2, and so on. - Every descriptor has a globally unique and immutable
sourceId, such asatlas-prod-a/app/orders-00. _idvalues must be globally unique across the configured namespaces.- Every insert, update, replace, and delete for one primary key must stay in the same source partition for that key’s lifetime.
- Do not remove, renumber, rebind, or repartition an active source partition. Create a new Pinot table, snapshot/backfill, catch up CDC, and cut over queries instead.
- Do not use
hash(_id) % currentPartitionCountfor upstream routing. Increasing the partition count would move existing keys and break upsert partition affinity.
_id:
Prerequisites
- MongoDB Atlas, a replica set, or a sharded cluster. Standalone
mongodprocesses do not support Change Streams. - MongoDB credentials available to Pinot controllers and servers.
findandchangeStreampermissions on every source namespace.- If you use registry mode,
findon the manifest collection andlistCollectionson source databases. - If you use
outputMode=full_document, MongoDB Server 6.0 or later with Change Stream pre/post-images enabled. - An oplog and post-image retention window longer than the maximum Pinot outage and recovery window.
Static Manifest Mode
Use static mode when the source partition list is fixed. OmitpartitionDiscoveryMode and set sourcePartitions to a JSON array encoded as a string.
Registry Manifest Mode
UsepartitionDiscoveryMode=mongodb_manifest when an upstream routing service can append new physical bucket collections. The table config allowlists connection references and points Pinot at one authoritative registry document.
maxPartitionCount is a safety limit that prevents a malformed registry from creating unbounded Pinot segments or MongoDB cursors.
Output Modes
For
full_document, enable post-images on every source collection:
Current-State Upsert Example
Schema:comparisonColumns uses the connector-generated comparison value so MongoDB event order is preserved. strictReplicaGroup is required so a query sees a consistent upsert view for each partition.
Capturing Initial Offsets
When creating a table withauto.offset.reset=largest, the controller captures a starting boundary for each partition that does not already provide initialOffset.
To include historical documents:
- Capture an exact resume boundary for each MongoDB namespace.
- Snapshot/backfill the historical data up to that boundary.
- Configure each descriptor with the captured
initialOffset. - Start realtime CDC consumption from those offsets.
clusterTime; the offset must include the resume token and its safe logical time.
Adding Capacity
To append a partition safely:- Create a new, quiescent physical namespace.
- Capture the namespace UUID and exact initial offset.
- Append only the next highest dense
partitionId. - Wait until Pinot reports the new partition group consuming on the required replicas.
- Route only new keys to the new namespace.
segmentPartitionConfig on a table whose MongoDB source-partition count can grow. A growing partition count changes key ownership for older rows.

