1
+ .. _kafka-source-change-streams:
2
+
1
3
==============
2
4
Change Streams
3
5
==============
@@ -14,14 +16,14 @@ Overview
14
16
--------
15
17
16
18
In this guide, you can learn about **change streams** and how they are
17
- used in a {+mkc+} source connector.
19
+ used in a {+mkc+} source connector.
18
20
19
21
Change Streams
20
22
--------------
21
23
22
24
Change streams are a feature of MongoDB that allow you to receive real-time
23
25
updates on data changes. Change streams return
24
- **change event documents**. A change event document is a document in your
26
+ **change event documents**. A change event document is a document in your
25
27
**oplog** that contains idempotent instructions to recreate a change that
26
28
occurred in your MongoDB deployment as well as the metadata related to that
27
29
change.
@@ -36,24 +38,35 @@ works.
36
38
Change streams are available for replica sets and sharded clusters. A
37
39
standalone MongoDB instance cannot produce a change stream.
38
40
39
- For more information on change streams, see the following MongoDB manual entries:
41
+ For more information on the oplog, see the MongoDB manual entry on the
42
+ :manual:`Replica Set Oplog </core/replica-set-oplog/>`.
43
+
44
+ You can use an aggregation pipeline to modify change stream events in one or
45
+ more of the following ways:
46
+
47
+ - Filter change events by operation type
48
+ - Project specific fields
49
+ - Update the value of fields
50
+ - Add additional fields
51
+ - Trim the amount of data generated by the change stream
40
52
41
- - :manual:`Change streams </changeStreams/>`
42
- - :manual:`Oplog </core/replica-set-oplog/>`
53
+ For a list of aggregation operators you can use with a change stream, see
54
+ the guide on :manual:`Modify Change Stream Output <changeStreams/#modify-change-stream-output>`
55
+ in the MongoDB manual.
43
56
44
57
Change Event Structure
45
58
~~~~~~~~~~~~~~~~~~~~~~
46
59
47
60
You can find the complete structure of change event documents, including
48
- descriptions of all fields,
49
- :ref:`in the MongoDB manual <change-stream-output>`.
61
+ descriptions of all fields,
62
+ :ref:`in the MongoDB manual <change-stream-output>`.
50
63
51
64
.. note:: The Full Document Option
52
65
53
66
If you want Kafka Connect to receive just the document created or modified
54
67
from your change operation, use the ``publish.full.document.only=true``
55
- option. For more information see our
56
- guide on <TODO: Link to source connector properties> .
68
+ option. For more information, see the :ref:`<source-configuration-change-stream>`
69
+ page .
57
70
58
71
Source Connectors
59
72
-----------------
@@ -67,7 +80,7 @@ connector closes its change stream when you stop it.
67
80
68
81
Your source connector uses the MongoDB Java driver to create a change
69
82
stream. For more information, see this guide on change streams in the MongoDB
70
- java driver. <TODO: Link to Watch For Changes Usage Example>
83
+ Java driver. <TODO: Link to Watch For Changes Usage Example>
71
84
72
85
Resume Tokens
73
86
~~~~~~~~~~~~~
@@ -76,7 +89,7 @@ Your connector stores a **resume token** to keep track of what changes
76
89
it has processed. A resume token is a piece of data that references
77
90
the ``_id`` field of a change event document in your MongoDB oplog.
78
91
Your connector only processes relevant change event documents written to the oplog after the
79
- document referenced by its resume token.
92
+ document referenced by its resume token.
80
93
81
94
If your source connector does not have a resume token, such as when you start
82
95
the connector for the first time, your connector processes relevant change
@@ -89,5 +102,5 @@ events written to the oplog after it first connects to MongoDB.
89
102
90
103
If your source connector's resume token does not correspond to any entry in your
91
104
oplog, your connector has an invalid resume token. To learn how to recover from an
92
- invalid resume token,
105
+ invalid resume token,
93
106
:ref:`see our troubleshooting guide <kafka-troubleshoot-recover-invalid-resume-token>`.
0 commit comments