Skip to content

Commit 299cc59

Browse files
committed
Use extracts for watch() options
1 parent 8b9ea06 commit 299cc59

File tree

4 files changed

+286
-187
lines changed

4 files changed

+286
-187
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
ref: watch-option-batchSize
2+
content: |
3+
Specifies the batch size for the cursor, which will apply to both the initial
4+
``aggregate`` command and any subsequent ``getMore`` commands. This determines
5+
the maximum number of change events to return in each response from the
6+
server.
7+
8+
.. note::
9+
10+
Irrespective of the ``batchSize`` option, the initial ``aggregate`` command
11+
response for a change stream generally does not include any documents
12+
unless another option is used to configure its starting point (e.g.
13+
``startAfter``).
14+
---
15+
ref: watch-option-fullDocument
16+
content: |
17+
Determines how the ``fullDocument`` response field will be populated for
18+
update operations.
19+
20+
By default, change streams only return the delta of fields (via an
21+
``updateDescription`` field) for update operations and ``fullDocument`` is
22+
omitted. Insert and replace operations always include the ``fullDocument``
23+
field. Delete operations omit the field as the document no longer exists.
24+
25+
Specify "updateLookup" to return the current majority-committed version of the
26+
updated document.
27+
28+
MongoDB 6.0+ allows returning the post-image of the modified document if the
29+
collection has ``changeStreamPreAndPostImages`` enabled. Specify
30+
"whenAvailable" to return the post-image if available or a null value if not.
31+
Specify "required" to return the post-image if available or raise an error if
32+
not.
33+
34+
The following values are supported:
35+
36+
- ``MongoDB\Operation\Watch::FULL_DOCUMENT_UPDATE_LOOKUP``
37+
- ``MongoDB\Operation\Watch::FULL_DOCUMENT_WHEN_AVAILABLE``
38+
- ``MongoDB\Operation\Watch::FULL_DOCUMENT_REQUIRED``
39+
40+
.. note::
41+
42+
This is an option of the ``$changeStream`` pipeline stage.
43+
---
44+
ref: watch-option-fullDocumentBeforeChange
45+
content: |
46+
Determines how the ``fullDocumentBeforeChange`` response field will be
47+
populated. By default, the field is omitted.
48+
49+
MongoDB 6.0+ allows returning the pre-image of the modified document if the
50+
collection has ``changeStreamPreAndPostImages`` enabled. Specify
51+
"whenAvailable" to return the pre-image if available or a null value if not.
52+
Specify "required" to return the pre-image if available or raise an error if
53+
not.
54+
55+
The following values are supported:
56+
57+
- ``MongoDB\Operation\Watch::FULL_DOCUMENT_BEFORE_CHANGE_WHEN_AVAILABLE``
58+
- ``MongoDB\Operation\Watch::FULL_DOCUMENT_BEFORE_CHANGE_REQUIRED``
59+
60+
.. note::
61+
62+
This is an option of the ``$changeStream`` pipeline stage.
63+
64+
.. versionadded: 1.13
65+
---
66+
ref: watch-option-maxAwaitTimeMS
67+
content: |
68+
Positive integer denoting the time limit in milliseconds for the server to
69+
block a getMore operation if no data is available.
70+
---
71+
ref: watch-option-resumeAfter
72+
content: |
73+
Specifies the logical starting point for the new change stream. The ``_id``
74+
field in documents returned by the change stream may be used here.
75+
76+
Using this option in conjunction with ``startAfter`` and/or
77+
``startAtOperationTime`` will result in a server error. The options are
78+
mutually exclusive.
79+
80+
.. note::
81+
82+
This is an option of the ``$changeStream`` pipeline stage.
83+
---
84+
ref: watch-option-showExpandedEvents
85+
content: |
86+
If true, instructs the server to include additional DDL events in the change
87+
stream. The additional events that may be included are:
88+
89+
- ``createIndexes``
90+
- ``dropIndexes``
91+
- ``modify``
92+
- ``create``
93+
- ``shardCollection``
94+
- ``reshardCollection`` (server 6.1+)
95+
- ``refineCollectionShardKey`` (server 6.1+)
96+
97+
This is not supported for server versions prior to 6.0 and will result in an
98+
exception at execution time if used.
99+
100+
.. note::
101+
102+
This is an option of the ``$changeStream`` pipeline stage.
103+
104+
.. versionadded:: 1.13
105+
---
106+
ref: watch-option-startAfter
107+
content: |
108+
Specifies the logical starting point for the new change stream. The ``_id``
109+
field in documents returned by the change stream may be used here. Unlike
110+
``resumeAfter``, this option can be used with a resume token from an
111+
"invalidate" event.
112+
113+
Using this option in conjunction with ``resumeAfter`` and/or
114+
``startAtOperationTime`` will result in a server error. The options are
115+
mutually exclusive.
116+
117+
This is not supported for server versions prior to 4.2 and will result in an
118+
exception at execution time if used.
119+
120+
.. note::
121+
122+
This is an option of the ``$changeStream`` pipeline stage.
123+
124+
.. versionadded: 1.5
125+
---
126+
ref: watch-option-startAtOperationTime
127+
content: |
128+
If specified, the change stream will only provide changes that occurred at or
129+
after the specified timestamp. Command responses from a MongoDB 4.0+ server
130+
include an ``operationTime`` that can be used here. By default, the
131+
``operationTime`` returned by the initial ``aggregate`` command will be used
132+
if available.
133+
134+
Using this option in conjunction with ``resumeAfter`` and/or ``startAfter``
135+
will result in a server error. The options are mutually exclusive.
136+
137+
This is not supported for server versions prior to 4.0 and will result in an
138+
exception at execution time if used.
139+
140+
.. note::
141+
142+
This is an option of the ``$changeStream`` pipeline stage.
143+
...

docs/includes/watch-options.rst

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)