Docs Menu
Docs Home
/ /

Propiedades de configuración de mapeo de espacios de nombres de MongoDB

Utilice las siguientes opciones de configuración para especificar en qué base de datos y colección de MongoDB escribe datos su conector receptor de MongoDB Kafka. Puede usar la configuración predeterminada. DefaultNamespaceMapper o especifique una clase personalizada.

Para obtener una lista de las configuraciones del conector del fregadero organizadas por categoría, consulte la guía en Propiedades de configuración del conector del sumidero.

Nombre
Descripción
namespace.mapper
Type: string

Description:
The fully-qualified class name of the class that specifies which database or collection in which to sink the data. The default DefaultNamespaceMapper uses values specified in the database and collection properties.

The connector includes an alternative class for specifying the
database and collection called FieldPathNamespaceMapper. See
for more information.

Default:
com.mongodb.kafka.connect.sink.namespace.mapping.DefaultNamespaceMapper
Accepted Values: A fully qualified Java class name of a class that implements the NamespaceMapper interface.

database

Required

Type: string

Description:
The name of the MongoDB database to which the sink connector writes.

Accepted Values: A MongoDB database name

Colección

Type: string

Description:
The name of the MongoDB collection to which the sink connector writes. If your sink connector follows multiple topics, this is the default collection for any writes that are not otherwise specified.
Default: The topic name.
Accepted Values: A MongoDB collection name

Si configura su conector de sumidero para usar FieldPathNamespaceMapper, puede especificar en qué base de datos y colección se hundirá un documento en función de los valores de campo de los datos.

Para habilitar este comportamiento de mapeo, configure la propiedad de configuración del conector de receptor namespace.mapper en el nombre de clase completo como se muestra a continuación:

namespace.mapper=com.mongodb.kafka.connect.sink.namespace.mapping.FieldPathNamespaceMapper

El FieldPathNamespaceMapper requiere que especifique las siguientes configuraciones:

  • Una o ambas propiedades de mapeo a una base de datos y colección

  • Una de las asignaciones key o value a una base de datos

  • Una de las asignaciones key o value a una colección

Puede utilizar la siguiente configuración para personalizar el comportamiento de FieldPathNamespaceMapper:

Nombre
Descripción
namespace.mapper.key.database.field
Type: string

Description:
The name of the key document field that specifies the name of the database in which to write.
namespace.mapper.key.collection.field
Type: string

Description:
The name of the key document field that specifies the name of the collection in which to write.
namespace.mapper.value.database.field
Type: string

Description:
The name of the value document field that specifies the name of the database in which to write.
namespace.mapper.value.collection.field
Type: string

Description:
The name of the value document field that specifies the name of the collection in which to write.
namespace.mapper.error.if.invalid
Type: boolean

Description:
Whether to throw an exception when either the document is missing the mapped field or it has an invalid BSON type.

When set to true, the connector does not process documents missing the mapped field or that contain an invalid BSON type. The connector may halt or skip processing depending on the related error-handling configuration settings.

When set to false, if a document is missing the mapped field or if it has an invalid BSON type, the connector defaults to writing to the specified database and collection settings.

Default: false
Accepted Values: true or false

Volver

Conexión MongoDB

En esta página