This connector is available as a built-in connector on StreamNative Cloud.
Prerequisites
- Valid credentials with the
readWriterole on the database. For more granular access control, you can specify a custom role that allowsinsert,remove, andupdateactions on the databases or collections. - The
connection.uriis in form ofmongodb+srv://username:password@cluster0.xxx.mongodb.net
Quick Start
- Setup the kcctl client: doc
-
Create a MongoDB Cluster, you can create one in k8s cluster with below yaml file:
-
Initialize the local MongoDB cluster:
-
Create a JSON file like the following:
-
Run the following command to create the connector:
Limitations
If you want to use the MongoDB CDC handler for data sourced from MongoDB instances by MongoDB source connector, you will need to selectSTRING or BYTES as the value converter for both MongoDB source and MongoDB sink connectors. Details can be found here.
Configuration
The MongoDB Kafka sink connector is configured using the following Required properties:
The full properties are also available from the offical MongoDB Kafka Sink Connector documentation.