Skip to content

Commit 19ce24a

Browse files
authored
DOCSP-32089: add update write model strategy (#142)
* DOCSP-32089: add write model strategy * fix anchor to get rid of error * fix anchor again
1 parent 7e25c97 commit 19ce24a

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

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

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ Strategies
4444
* - | **DefaultWriteModelStrategy**
4545
|
4646
- | **Description:**
47-
| This strategy uses the ``ReplaceOneDefaultStrategy`` by default, and the ``InsertOneDefaultStrategy`` if you set the ``timeseries.timefield`` option.
47+
| This strategy uses the ``ReplaceOneDefaultStrategy`` by
48+
default, and the ``InsertOneDefaultStrategy`` if you set the
49+
``timeseries.timefield`` option.
4850
|
4951
| This is the default value for the ``writemodel.strategy`` configuration setting.
5052

@@ -61,7 +63,9 @@ Strategies
6163
* - | **ReplaceOneDefaultStrategy**
6264
|
6365
- | **Description:**
64-
| Replaces at most one document in MongoDB that matches a sink record by the ``_id`` field. If no documents match, insert the sink record as a new document.
66+
| Replaces at most one document in MongoDB that matches a sink
67+
record by the ``_id`` field. If no documents match, the
68+
connector inserts the sink record as a new document.
6569
| Apply the following configuration to your sink connector to specify this setting:
6670

6771
.. code-block:: properties
@@ -71,19 +75,24 @@ Strategies
7175
* - | **ReplaceOneBusinessKeyStrategy**
7276
|
7377
- | **Description:**
74-
| Replaces at most one document that matches a sink record by a specified business key. If no documents match, insert the sink record as a new document.
78+
| Replaces at most one document that matches a sink record by a
79+
specified business key. If no documents match, the
80+
connector inserts the sink record as a new document.
7581
| Apply the following configuration to your sink connector to specify this setting:
7682

7783
.. code-block:: properties
7884

7985
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.ReplaceOneBusinessKeyStrategy
8086

81-
| To see an example showing how to use this strategy, see our :ref:`guide on write model strategies <kafka-sink-write-model-replace-example>`.
87+
| To see an example showing how to use this strategy, see our
88+
:ref:`guide on write model strategies <kafka-sink-write-model-replace-example>`.
8289

8390
* - | **DeleteOneDefaultStrategy**
8491
|
8592
- | **Description:**
86-
| 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.
93+
| Deletes at most one document that matches your sink connector's
94+
key structure by the ``_id`` field only when the document
95+
contains a null value structure.
8796
| This is implicitly specified when you set ``mongodb.delete.on.null.values=true``.
8897
| You can set this explicitly with the following configuration:
8998

@@ -101,7 +110,20 @@ Strategies
101110

102111
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.DeleteOneBusinessKeyStrategy
103112

104-
| To see an example showing how to use this strategy, see our :ref:`guide on write model strategies <kafka-sink-write-model-delete-example>`.
113+
| To see an example showing how to use this strategy, see our
114+
:ref:`guide on write model strategies <kafka-sink-write-model-delete-example>`.
115+
116+
* - | **UpdateOneDefaultStrategy**
117+
|
118+
- | **Description:**
119+
| Updates at most one document in MongoDB that matches a sink
120+
record by the ``_id`` field. If no documents match, the
121+
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
125+
126+
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneDefaultStrategy
105127

106128
* - | **UpdateOneTimestampsStrategy**
107129
|
@@ -113,12 +135,15 @@ Strategies
113135

114136
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneTimestampsStrategy
115137

116-
| To see an example showing how to use this strategy, see our :ref:`guide on write model strategies <kafka-sink-write-model-time-example>`.
138+
| To see an example showing how to use this strategy, see our
139+
:ref:`guide on write model strategies <kafka-sink-write-model-time-example>`.
117140

118141
* - | **UpdateOneBusinessKeyTimestampStrategy**
119142
|
120143
- | **Description:**
121-
| Add ``_insertedTS`` (inserted timestamp) and ``_modifiedTS`` (modified timestamp) fields into documents that match a business key.
144+
| Add ``_insertedTS`` (inserted timestamp) and ``_modifiedTS``
145+
(modified timestamp) fields into documents that match a business
146+
key.
122147
| Apply the following configuration to your sink connector to specify this setting:
123148

124149
.. code-block:: properties

source/sink-connector/fundamentals/write-strategies.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _sink-connector-write-model-strategies:
1+
.. _sink-connector-write-model-strategies-guide:
22

33
======================
44
Write Model Strategies
@@ -20,7 +20,8 @@ You can change how your connector writes data to MongoDB for use cases
2020
including the following:
2121

2222
- Insert documents instead of upserting them
23-
- Replace documents that match a filter other than the ``_id`` field
23+
- Replace or update documents that match a filter other than the ``_id``
24+
field
2425
- Delete documents that match a filter
2526

2627
You can configure how your connector writes data to MongoDB by specifying a

source/whats-new.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ What's New in 1.11
3636

3737
- Added support for regular expressions in the ``topic.namespace.map`` property.
3838

39-
- Added support for setting a custom delete write model strategy using the
40-
``delete.writemodel.strategy`` propery.
39+
- Added support for setting a custom delete write model strategy by using the
40+
``delete.writemodel.strategy`` configuration property.
4141

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

4445
- DDL events from Debezium are recorded as no-ops and no longer cause an error.
4546

0 commit comments

Comments
 (0)