@@ -9,8 +9,8 @@ Change Streams
9
9
:Status: Accepted
10
10
:Type: Standards
11
11
:Minimum Server Version: 3.6
12
- :Last Modified: 2022-03-25
13
- :Version: 1.13.1
12
+ :Last Modified: 2022-04-08
13
+ :Version: 1.14
14
14
15
15
.. contents ::
16
16
@@ -175,20 +175,34 @@ If an aggregate command with a ``$changeStream`` stage completes successfully, t
175
175
updateDescription: Optional <UpdateDescription >;
176
176
177
177
/**
178
- * Always present for operations of type ‘insert’ and ‘replace’. Also
179
- * present for operations of type ‘update’ if the user has specified ‘updateLookup’
180
- * in the ‘fullDocument’ arguments to the ‘$changeStream’ stage.
178
+ * Always present for operations of type 'insert' and 'replace'. Also
179
+ * present for operations of type 'update' if the user has specified
180
+ * 'updateLookup' for the 'fullDocument' option when creating the change
181
+ * stream.
181
182
*
182
- * For operations of type ‘ insert’ and ‘ replace’ , this key will contain the
183
- * document being inserted, or the new version of the document that is replacing
184
- * the existing document, respectively.
183
+ * For operations of type ' insert' and ' replace' , this key will contain the
184
+ * document being inserted or the new version of the document that is
185
+ * replacing the existing document, respectively.
185
186
*
186
- * For operations of type ‘ update’ , this key will contain a copy of the full
187
+ * For operations of type ' update' , this key will contain a copy of the full
187
188
* version of the document from some point after the update occurred. If the
188
189
* document was deleted since the updated happened, it will be null.
190
+ *
191
+ * Contains the point-in-time post-image of the modified document if the
192
+ * post-image is available and either "required" or "whenAvailable" was
193
+ * specified for the "fullDocument" option when creating the change stream.
194
+ * A post-image is always available for "insert" and "replace" events.
189
195
*/
190
196
fullDocument: Document | null ;
191
197
198
+ /**
199
+ * Contains the pre-image of the modified or deleted document if the
200
+ * pre-image is available for the change event and either "required" or
201
+ * "whenAvailable" was specified for the "fullDocumentBeforeChange" option
202
+ * when creating the change stream. If "whenAvailable" was specified but the
203
+ * pre-image is unavailable, this will be explicitly set to null.
204
+ */
205
+ fullDocumentBeforeChange: Document | null ;
192
206
}
193
207
194
208
class UpdateDescription {
@@ -347,16 +361,52 @@ Driver API
347
361
348
362
class ChangeStreamOptions {
349
363
/**
350
- * Allowed values: ‘updateLookup’. When set to ‘updateLookup’, the change notification
351
- * for partial updates will include both a delta describing the changes to the document,
352
- * as well as a copy of the entire document that was changed from some time after the
353
- * change occurred. The default is to not send a value.
354
- * For forward compatibility, a driver MUST NOT raise an error when a user provides an
355
- * unknown value. The driver relies on the server to validate this option.
364
+ * Allowed values: 'updateLookup', 'whenAvailable', 'required'.
365
+ *
366
+ * The default is to not send a value. By default, the change notification
367
+ * for partial updates will include a delta describing the changes to the
368
+ * document.
369
+ *
370
+ * When set to 'updateLookup', the change notification for partial updates
371
+ * will include both a delta describing the changes to the document as well
372
+ * as a copy of the entire document that was changed from some time after
373
+ * the change occurred.
374
+ *
375
+ * When set to 'whenAvailable', configures the change stream to return the
376
+ * post-image of the modified document for replace and update change events
377
+ * if the post-image for this event is available.
378
+ *
379
+ * When set to 'required', the same behavior as 'whenAvailable' except that
380
+ * an error is raised if the post-image is not available.
381
+ *
382
+ * For forward compatibility, a driver MUST NOT raise an error when a user
383
+ * provides an unknown value. The driver relies on the server to validate
384
+ * this option.
385
+ *
356
386
* @note this is an option of the `$changeStream` pipeline stage.
357
387
*/
358
388
fullDocument: Optional <String >;
359
389
390
+ /**
391
+ * Allowed values: 'whenAvailable', 'required', 'off'.
392
+ *
393
+ * The default is to not send a value, which is equivalent to 'off'.
394
+ *
395
+ * When set to 'whenAvailable', configures the change stream to return the
396
+ * pre-image of the modified document for replace, update, and delete change
397
+ * events if it is available.
398
+ *
399
+ * When set to 'required', the same behavior as 'whenAvailable' except that
400
+ * an error is raised if the pre-image is not available.
401
+ *
402
+ * For forward compatibility, a driver MUST NOT raise an error when a user
403
+ * provides an unknown value. The driver relies on the server to validate
404
+ * this option.
405
+ *
406
+ * @note this is an option of the `$changeStream` pipeline stage.
407
+ */
408
+ fullDocumentBeforeChange: Optional <String >;
409
+
360
410
/**
361
411
* Specifies the logical starting point for the new change stream.
362
412
*
@@ -946,3 +996,6 @@ Changelog
946
996
+------------+------------------------------------------------------------+
947
997
| 2022-03-25 | Do not error when parsing change stream event documents. |
948
998
+------------+------------------------------------------------------------+
999
+ | 2022-04-08 | Support returning point-in-time pre and post-images with |
1000
+ | | fullDocumentBeforeChange and fullDocument. |
1001
+ +------------+------------------------------------------------------------+
0 commit comments