|
| 1 | +======================== |
| 2 | +Change Stream Properties |
| 3 | +======================== |
| 4 | + |
| 5 | +.. default-domain:: mongodb |
| 6 | + |
| 7 | +.. contents:: On this page |
| 8 | + :local: |
| 9 | + :backlinks: none |
| 10 | + :depth: 2 |
| 11 | + :class: singlecol |
| 12 | + |
| 13 | +Overview |
| 14 | +-------- |
| 15 | + |
| 16 | +Use the following configuration settings to specify aggregation pipelines |
| 17 | +for change streams and read preferences for change stream cursors. |
| 18 | + |
| 19 | +.. include:: /includes/source-config-link.rst |
| 20 | + |
| 21 | +Settings |
| 22 | +-------- |
| 23 | + |
| 24 | +.. list-table:: |
| 25 | + :header-rows: 1 |
| 26 | + :widths: 35 65 |
| 27 | + |
| 28 | + * - Name |
| 29 | + - Description |
| 30 | + |
| 31 | + * - | **pipeline** |
| 32 | + - | **Type:** string |
| 33 | + | |
| 34 | + | **Description:** |
| 35 | + | An array of aggregation pipelines to run in your change stream. |
| 36 | + |
| 37 | + .. example:: |
| 38 | + |
| 39 | + .. code-block:: none |
| 40 | + |
| 41 | + [{"$match": {"operationType": "insert"}}, {"$addFields": {"Kafka": "Rules!"}}] |
| 42 | + |
| 43 | + .. tip:: Additional Examples |
| 44 | + |
| 45 | + - (TODO: link to Custom pipeline example) |
| 46 | + - (TODO: link to Multiple source example) |
| 47 | + |
| 48 | + | **Default**: ``[]`` |
| 49 | + | **Accepted Values**: Valid aggregation pipeline stage |
| 50 | + |
| 51 | + * - | **change.stream.full.document** |
| 52 | + - | **Type:** string |
| 53 | + | |
| 54 | + | **Description:** |
| 55 | + | Determines what values your change stream returns on update |
| 56 | + operations. |
| 57 | + | The ``default`` setting returns the differences between the original |
| 58 | + document and the updated document. |
| 59 | + | The ``updateLookup`` setting returns the differences between the |
| 60 | + original document and updated document as well as a copy of the |
| 61 | + entire updated document at a *point in time* after the update. |
| 62 | + |
| 63 | + .. tip:: |
| 64 | + |
| 65 | + For more information on how this change stream option works, see |
| 66 | + the MongoDB server manual guide on :manual:`Lookup Full Document for |
| 67 | + Update Operations </changeStreams/#lookup-full-document-for-update-operations>`. |
| 68 | + | |
| 69 | + | **Default**: ``""`` |
| 70 | + | **Accepted Values**: ``""`` or ``"default"`` or ``"updateLookup"`` |
| 71 | + |
| 72 | + * - | **publish.full.document.only** |
| 73 | + - | **Type:** boolean |
| 74 | + | |
| 75 | + | **Description:** |
| 76 | + | Whether to publish the changed document instead of the full change |
| 77 | + stream document. When set to ``true``, the connector |
| 78 | + automatically sets the ``change.stream.full.document`` property to |
| 79 | + ``updateLookup`` to receive the updated documents. |
| 80 | + | |
| 81 | + | **Default**: ``false`` |
| 82 | + | **Accepted Values**: ``true`` or ``false`` |
| 83 | + |
| 84 | + * - | **collation** |
| 85 | + - | **Type:** string |
| 86 | + | |
| 87 | + | **Description:** |
| 88 | + | A JSON :manual:`collation document </reference/collation/#collation-document>` |
| 89 | + that specifies language-specific ordering rules that MongoDB |
| 90 | + applies to the documents returned by the change stream. |
| 91 | + | |
| 92 | + | **Default**: ``""`` |
| 93 | + | **Accepted Values**: A valid collation JSON document |
| 94 | + |
| 95 | + * - | **copy.existing.pipeline** |
| 96 | + - | **Type:** string |
| 97 | + | |
| 98 | + | **Description:** |
| 99 | + | An array of :manual:`pipeline operations </core/aggregation-pipeline/>` |
| 100 | + to run when copying existing data. You can use this setting to |
| 101 | + improve the use of indexes by the copying manager to make the copying |
| 102 | + process more efficient. |
| 103 | + |
| 104 | + .. example:: |
| 105 | + |
| 106 | + The following example shows how you can use the :manual:`$match </reference/operator/aggregation/match/>` |
| 107 | + aggregation operator to copy only documents that contain a |
| 108 | + ``closed`` field with a value of ``false``. |
| 109 | + |
| 110 | + .. code-block:: none |
| 111 | + |
| 112 | + copy.existing.pipeline=[ { "$match": { "closed": "false" } } ] |
| 113 | + |
| 114 | + | **Default**: ``[]`` |
| 115 | + | **Accepted Values**: Valid aggregation pipeline stages |
| 116 | + |
| 117 | + * - | **batch.size** |
| 118 | + - | **Type:** int |
| 119 | + | |
| 120 | + | **Description:** |
| 121 | + | The change stream cursor batch size. |
| 122 | + | |
| 123 | + | **Default**: ``0`` |
| 124 | + | **Accepted Values**: An integer |
| 125 | + |
| 126 | + * - | **poll.await.time.ms** |
| 127 | + - | **Type:** long |
| 128 | + | |
| 129 | + | **Description:** |
| 130 | + | The amount of time in milliseconds to wait before checking the change |
| 131 | + stream cursor for new results. |
| 132 | + | |
| 133 | + | **Default**: ``5000`` |
| 134 | + | **Accepted Values**: An integer |
| 135 | + |
| 136 | + * - | **poll.max.batch.size** |
| 137 | + - | **Type:** int |
| 138 | + | |
| 139 | + | **Description:** |
| 140 | + | Maximum number of documents to read in a single batch when polling |
| 141 | + a change stream cursor for new data. You can use this setting to |
| 142 | + limit the amount of data buffered internally in the connector. |
| 143 | + | |
| 144 | + | **Default**: ``1000`` |
| 145 | + | **Accepted Values**: An integer |
| 146 | + |
0 commit comments