Skip to content

Commit fcd140a

Browse files
authored
DOCSP-29571: delete writemodel (#145)
* DOCSP-29571: delete writemodel strategy * fixes * wording fix * tip * note * CC PR fixes 1 * change examples * CC PR fixes 2 * RL nit change
1 parent 34c0b49 commit fcd140a

File tree

2 files changed

+82
-35
lines changed

2 files changed

+82
-35
lines changed

source/sink-connector/configuration-properties/write-strategies.txt

Lines changed: 80 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,44 @@ Overview
1515

1616
.. _sink-configuration-write-model-strategy-description-start:
1717

18-
Use the strategies in the following table to specify how the {+sink-connector+}
19-
writes data into MongoDB. You can specify a write strategy with the following
18+
You can set configuration properties to specify how the
19+
{+sink-connector+} writes data into MongoDB. The following sections
20+
describe the configuration properties that you can set to customize this
21+
behavior.
22+
23+
Write Model
24+
~~~~~~~~~~~
25+
26+
Set the ``writemodel.strategy`` configuration property to specify how
27+
the sink connector writes data when it receives a sink record.
28+
29+
You can set the value of ``writemodel.strategy`` to any of the
30+
fully qualified class names of the write model strategies described in
31+
the :ref:`Strategies <sink-connector-write-model-strategies>` section of
32+
this page. You can specify a strategy by setting the following
33+
configuration:
34+
35+
.. code-block:: properties
36+
37+
writemodel.strategy=<a write model strategy>
38+
39+
Delete Write Model
40+
~~~~~~~~~~~~~~~~~~
41+
42+
Set the ``delete.writemodel.strategy`` configuration property to specify
43+
how the sink connector writes data when it receives a tombstone
44+
event. A tombstone event is a record that contains a key but no
45+
value, which signifies a deleted record.
46+
47+
You can set the value of ``delete.writemodel.strategy`` to any of the
48+
fully qualified class names of the write model strategies described in
49+
the :ref:`Strategies <sink-connector-write-model-strategies>` section of
50+
this page. You can specify a strategy by setting the following
2051
configuration:
2152

2253
.. code-block:: properties
2354

24-
writemodel.strategy=<a writemodel strategy>
55+
delete.writemodel.strategy=<a write model strategy>
2556

2657
.. _sink-configuration-write-model-strategy-description-end:
2758

@@ -48,41 +79,45 @@ Strategies
4879
default, and the ``InsertOneDefaultStrategy`` if you set the
4980
``timeseries.timefield`` option.
5081
|
51-
| This is the default value for the ``writemodel.strategy`` configuration setting.
82+
| This is the default value value for the ``writemodel.strategy``
83+
configuration property.
5284

5385
* - | **InsertOneDefaultStrategy**
5486
|
5587
- | **Description:**
5688
| Insert each sink record into MongoDB as a document.
57-
| Apply the following configuration to your sink connector to specify this setting:
89+
| To specify this strategy, set the configuration property to the
90+
following class name:
5891

59-
.. code-block:: properties
92+
.. code-block:: none
6093

61-
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.InsertOneDefaultStrategy
94+
com.mongodb.kafka.connect.sink.writemodel.strategy.InsertOneDefaultStrategy
6295

6396
* - | **ReplaceOneDefaultStrategy**
6497
|
6598
- | **Description:**
6699
| Replaces at most one document in MongoDB that matches a sink
67100
record by the ``_id`` field. If no documents match, the
68101
connector inserts the sink record as a new document.
69-
| Apply the following configuration to your sink connector to specify this setting:
102+
| To specify this strategy, set the configuration property to the
103+
following class name:
70104

71-
.. code-block:: properties
105+
.. code-block:: none
72106

73-
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.ReplaceOneDefaultStrategy
107+
com.mongodb.kafka.connect.sink.writemodel.strategy.ReplaceOneDefaultStrategy
74108

75109
* - | **ReplaceOneBusinessKeyStrategy**
76110
|
77111
- | **Description:**
78112
| Replaces at most one document that matches a sink record by a
79113
specified business key. If no documents match, the
80114
connector inserts the sink record as a new document.
81-
| Apply the following configuration to your sink connector to specify this setting:
115+
| To specify this strategy, set the configuration property to the
116+
following class name:
82117

83-
.. code-block:: properties
118+
.. code-block:: none
84119

85-
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.ReplaceOneBusinessKeyStrategy
120+
com.mongodb.kafka.connect.sink.writemodel.strategy.ReplaceOneBusinessKeyStrategy
86121

87122
| To see an example showing how to use this strategy, see our
88123
:ref:`guide on write model strategies <kafka-sink-write-model-replace-example>`.
@@ -93,22 +128,30 @@ Strategies
93128
| Deletes at most one document that matches your sink connector's
94129
key structure by the ``_id`` field only when the document
95130
contains a null value structure.
96-
| This is implicitly specified when you set ``mongodb.delete.on.null.values=true``.
97-
| You can set this explicitly with the following configuration:
131+
|
132+
| This is the default value for the
133+
``delete.writemodel.strategy`` configuration property.
134+
|
135+
| This strategy is set as the default value of the
136+
``writemodel.strategy`` property when you set
137+
``mongodb.delete.on.null.values=true``.
138+
| To specify this strategy, set the configuration property to the
139+
following class name:
98140

99-
.. code-block:: properties
141+
.. code-block:: none
100142

101-
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.DeleteOneDefaultStrategy
143+
com.mongodb.kafka.connect.sink.writemodel.strategy.DeleteOneDefaultStrategy
102144

103145
* - | **DeleteOneBusinessKeyStrategy**
104146
|
105147
- | **Description:**
106148
| Deletes at most one MongoDB document that matches a sink record by a business key.
107-
| Apply the following configuration to your sink connector to specify this setting:
149+
| To specify this strategy, set the configuration property to the
150+
following class name:
108151

109-
.. code-block:: properties
152+
.. code-block:: none
110153

111-
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.DeleteOneBusinessKeyStrategy
154+
com.mongodb.kafka.connect.sink.writemodel.strategy.DeleteOneBusinessKeyStrategy
112155

113156
| To see an example showing how to use this strategy, see our
114157
:ref:`guide on write model strategies <kafka-sink-write-model-delete-example>`.
@@ -119,21 +162,23 @@ Strategies
119162
| Updates at most one document in MongoDB that matches a sink
120163
record by the ``_id`` field. If no documents match, the
121164
connector inserts the sink record as a new document.
122-
| Apply the following configuration to your sink connector to specify this setting:
123-
124-
.. code-block:: properties
165+
| To specify this strategy, set the configuration property to the
166+
following class name:
167+
168+
.. code-block:: none
125169

126-
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneDefaultStrategy
170+
com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneDefaultStrategy
127171

128172
* - | **UpdateOneTimestampsStrategy**
129173
|
130174
- | **Description:**
131175
| Add ``_insertedTS`` (inserted timestamp) and ``_modifiedTS`` (modified timestamp) fields into documents.
132-
| Apply the following configuration to your sink connector to specify this setting:
133-
134-
.. code-block:: properties
135-
136-
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneTimestampsStrategy
176+
| To specify this strategy, set the configuration property to the
177+
following class name:
178+
179+
.. code-block:: none
180+
181+
com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneTimestampsStrategy
137182

138183
| To see an example showing how to use this strategy, see our
139184
:ref:`guide on write model strategies <kafka-sink-write-model-time-example>`.
@@ -144,10 +189,11 @@ Strategies
144189
| Add ``_insertedTS`` (inserted timestamp) and ``_modifiedTS``
145190
(modified timestamp) fields into documents that match a business
146191
key.
147-
| Apply the following configuration to your sink connector to specify this setting:
148-
149-
.. code-block:: properties
192+
| To specify this strategy, set the configuration property to the
193+
following class name:
194+
195+
.. code-block:: none
150196

151-
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneBusinessKeyTimestampStrategy
197+
com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneBusinessKeyTimestampStrategy
152198

153-
.. _sink-configuration-write-model-strategy-table-end:
199+
.. _sink-configuration-write-model-strategy-table-end:

source/whats-new.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ What's New in 1.11
4141
Naming page.
4242

4343
- Added support for setting a custom delete write model strategy by using the
44-
``delete.writemodel.strategy`` configuration property.
44+
``delete.writemodel.strategy`` configuration property. To learn more,
45+
see :ref:`sink-configuration-write-model-strategy`.
4546

4647
- Added the ``UpdateOneDefaultStrategy`` write model strategy. To learn
4748
more, see the list of :ref:`Write Model Strategies <sink-connector-write-model-strategies>`.

0 commit comments

Comments
 (0)