@@ -32,3 +32,55 @@ To view the current values of cluster parameters, use the
32
32
33
33
Parameters
34
34
----------
35
+
36
+ .. |mongod-only| replace:: Available for :binary:`~bin.mongod` only.
37
+
38
+ .. |mongos-only| replace:: Available for :binary:`~bin.mongos` only.
39
+
40
+ .. |both| replace:: Available for both :binary:`~bin.mongod` and :binary:`~bin.mongos`.
41
+
42
+ .. parameter:: changeStreamOptions
43
+
44
+ .. versionadded:: 6.0
45
+
46
+ |both|
47
+
48
+ This is an object containing :ref:`change stream <change-streams-update-event>`
49
+ configuration options.
50
+
51
+ You can only set ``changeStreamOptions`` on mongos or a
52
+ replica set primary. The value is set cluster-wide.
53
+
54
+ .. parameter:: changeStreamOptions.preAndPostImages.expireAfterSeconds
55
+
56
+ .. versionadded:: 6.0
57
+
58
+ *Default*: off
59
+
60
+ Controls the retention policy of change stream pre- and post-images.
61
+ Pre- and post-images are the versions of a document before and after
62
+ document modification respectively. ``expireAfterSeconds``
63
+ controls how long pre- and post-images are retained.
64
+
65
+ When ``expireAfterSeconds`` is ``off``, MongoDB uses the default retention
66
+ policy: pre- and post-images are retained until the corresponding change
67
+ stream events are removed from the :term:`oplog`.
68
+
69
+ To specify the minimum pre- and post-image retention time:
70
+
71
+ - Set ``expireAfterSeconds`` using an integer.
72
+
73
+ - If a change stream event is removed from the oplog, then the
74
+ corresponding pre- and post-images are also deleted regardless of the
75
+ ``expireAfterSeconds`` pre- and post-image retention time.
76
+
77
+ The following example sets the retention time for pre- and post-images in
78
+ change streams to ``100 seconds``:
79
+
80
+ .. code-block:: javascript
81
+
82
+ db.runCommand( {
83
+ setClusterParameter: {
84
+ changeStreamOptions: { preAndPostImages: { expireAfterSeconds: 100 } }
85
+ }
86
+ } )
0 commit comments