Overview
Use the following configuration settings to specify which MongoDB database and collection that your MongoDB Kafka sink connector writes data to. You can use the default DefaultNamespaceMapper or specify a custom class.
For a list of sink connector configuration settings organized by category, see the guide on Sink Connector Configuration Properties.
Settings
Name | Description | |
|---|---|---|
namespace.mapper | Type: string Accepted Values: A fully qualified Java class name of a class that implements the | |
database | Required | |
collection | Type: string Default: The topic name. Accepted Values: A MongoDB collection name |
FieldPathNamespaceMapper Settings
If you configure your sink connector to use the FieldPathNamespaceMapper, you can specify which database and collection to sink a document based on the data's field values.
To enable this mapping behavior, set your sink connector namespace.mapper configuration property to the fully-qualified class name as shown below:
namespace.mapper=com.mongodb.kafka.connect.sink.namespace.mapping.FieldPathNamespaceMapper
The FieldPathNamespaceMapper requires you to specify the following settings:
One or both mapping properties to a database and collection
One of the
keyorvaluemappings to a databaseOne of the
keyorvaluemappings to a collection
You can use the following settings to customize the behavior of the FieldPathNamespaceMapper:
Name | Description |
|---|---|
namespace.mapper.key.database.field | Type: string |
namespace.mapper.key.collection.field | Type: string |
namespace.mapper.value.database.field | Type: string |
namespace.mapper.value.collection.field | Type: string |
namespace.mapper.error.if.invalid | Type: boolean |