Docs Menu
Docs Home
/ /

Estrategias de modelo de escritura del conector de sumidero

Puede configurar las propiedades para especificar cómo el conector receptor de MongoDB Kafka escribe datos en MongoDB. Las siguientes secciones describen las propiedades que puede configurar para personalizar este comportamiento.

Establezca el writemodel.strategy Propiedad de configuración para especificar cómo el conector de receptor escribe datos cuando recibe un registro de receptor.

Puede establecer el valor de writemodel.strategy en cualquiera de los nombres de clase completamente calificados de las estrategias del modelo de escritura descritas en el Sección"Estrategias" de esta página. Puede especificar una estrategia configurando lo siguiente:

writemodel.strategy=<a write model strategy>

Establece la propiedad de configuración delete.writemodel.strategy para especificar cómo el conector del destino escribe datos al recibir un evento tombstone. Un evento tombstone es un registro que contiene una clave pero sin valor, lo que indica un registro borrado.

Puede asignar el valor delete.writemodel.strategy a cualquiera de los nombres de clase completos de las estrategias del modelo de escritura descritas en la sección "Estrategias" de esta página. Puede especificar una estrategia configurando lo siguiente:

delete.writemodel.strategy=<a write model strategy>

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
DefaultWriteModelStrategy

Description:
This strategy uses the ReplaceOneDefaultStrategy by default, and the InsertOneDefaultStrategy if you set the timeseries.timefield option.

This is the default value value for the writemodel.strategy configuration property.
InsertOneDefaultStrategy

Description:
Insert each sink record into MongoDB as a document.
To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.InsertOneDefaultStrategy
ReplaceOneDefaultStrategy

Description:
Replaces at most one document in MongoDB that matches a sink record by the _id field. If no documents match, the connector inserts the sink record as a new document.
To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.ReplaceOneDefaultStrategy
ReplaceOneBusinessKeyStrategy

Description:
Replaces at most one document that matches a sink record by a specified business key. If no documents match, the connector inserts the sink record as a new document.
To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.ReplaceOneBusinessKeyStrategy
To see an example showing how to use this strategy, see our guide on write model strategies.
DeleteOneDefaultStrategy

Description:
Deletes at most one document that matches your sink connector's key structure by the _id field only when the document contains a null value structure.

This is the default value for the delete.writemodel.strategy configuration property.

This strategy is set as the default value of the writemodel.strategy property when you set delete.on.null.values=true.
To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.DeleteOneDefaultStrategy
DeleteOneBusinessKeyStrategy

Description:
Deletes at most one MongoDB document that matches a sink record by a business key. This strategy requires a valueDoc for key generation. To leverage the PartialKeyStrategy for key generation, use the DeleteOneTombstoneBusinessKeyStrategy.

To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.DeleteOneBusinessKeyStrategy
To see an example showing how to use this strategy, see our guide on write model strategies.
DeleteOneTombstoneBusinessKeyStrategy

Description:
Deletes at most one MongoDB document that matches a sink record by a business key. This strategy leverages the PartialKeyStrategy to create the key used for deletion.

To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.DeleteOneTombstoneBusinessKeyStrategy
UpdateOneDefaultStrategy

Description:
Updates at most one document in MongoDB that matches a sink record by the _id field. If no documents match, the connector inserts the sink record as a new document.
To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneDefaultStrategy
UpdateOneTimestampsStrategy

Description:
Add _insertedTS (inserted timestamp) and _modifiedTS (modified timestamp) fields into documents.
To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneTimestampsStrategy
To see an example showing how to use this strategy, see our guide on write model strategies.
UpdateOneBusinessKeyTimestampStrategy

Description:
Add _insertedTS (inserted timestamp) and _modifiedTS (modified timestamp) fields into documents that match a business key.
To specify this strategy, set the configuration property to the following class name:
com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneBusinessKeyTimestampStrategy

Volver

Estrategia Id

En esta página