@@ -44,6 +44,13 @@ stream response document can have.
44
44
...
45
45
]
46
46
},
47
+ "operationDescription": {
48
+ "indexes": [
49
+ <document>
50
+ ]
51
+ },
52
+ "collectionUUID": <uuid>,
53
+ "wallTime": <isodate>,
47
54
"clusterTime" : <Timestamp>,
48
55
"txnNumber" : <NumberLong>,
49
56
"lsid" : {
@@ -100,6 +107,8 @@ following table describes each field in the change stream response document:
100
107
- ``rename``
101
108
- ``dropDatabase``
102
109
- ``invalidate``
110
+ - ``createIndexes``
111
+ - ``dropIndexes``
103
112
104
113
* - ``fullDocument``
105
114
- document
@@ -224,6 +233,36 @@ following table describes each field in the change stream response document:
224
233
| ``newSize``
225
234
- integer
226
235
- The number of elements in the truncated array.
236
+ * - ``operationDescription``
237
+ - document
238
+ - A document describing the operation performed.
239
+
240
+ This document and its fields only appears if the ``operationType`` value
241
+ is an expanded event.
242
+
243
+ .. versionadded:: 6.0
244
+
245
+ * - ``operationDescription.indexes``
246
+ - array
247
+ - An array of documents listing the indexes that were created or dropped
248
+ by the operation.
249
+
250
+ This field only appears when the ``operationType`` value is ``createIndexes``
251
+ or ``dropIndexes``.
252
+
253
+ .. versionadded:: 6.0
254
+
255
+ * - ``wallTime``
256
+ - ISODate
257
+ - ISO date from the oplog entry associated with the event.
258
+
259
+ .. versionadded:: 6.0
260
+
261
+ * - ``collectionUUID``
262
+ - UUID
263
+ - UUID identifying the collection.
264
+
265
+ .. versionadded:: 6.0
227
266
228
267
* - ``clusterTime``
229
268
@@ -555,3 +594,65 @@ watched database leads to an
555
594
556
595
.. include:: /includes/extracts/changestream-invalid-events.rst
557
596
597
+
598
+ .. _change-event-createIndexes:
599
+
600
+ ``createIndexes`` Event
601
+ -----------------------
602
+
603
+ .. versionadded:: 6.0
604
+
605
+ A ``createIndexes`` event occurs when an index is created on the collection and
606
+ the change stream has the ``showExpandedEvents`` option set to ``true``.
607
+
608
+ The following example shows a ``createIndexes`` event:
609
+
610
+ .. code-block:: text
611
+
612
+ {
613
+ _id: { <ResumeToken> },
614
+ operationType: 'createIndexes',
615
+ clusterTime: Timestamp({ t: 1651257835, i: 1 }),
616
+ collectionUUID: UUID("06bced37-7cc8-4267-96aa-a58a422153d8"),
617
+ wallTime: ISODate("2022-04-29T18:43:55.160Z"),
618
+ ns: {
619
+ db: 'test',
620
+ coll: 'authors'
621
+ },
622
+ operationDescription: {
623
+ indexes: [
624
+ { v: 2, key: { name: 1 }, name: 'name_1' }
625
+ ]
626
+ }
627
+ }
628
+
629
+
630
+ .. _change-event-dropIndexes:
631
+
632
+ ``dropIndexes`` Event
633
+ ---------------------
634
+
635
+ .. versionadded:: 6.0
636
+
637
+ A ``dropIndexes`` event occurs when an index is dropped from the collection and
638
+ the change stream has the ``showExpandedEvents`` option set to ``true``.
639
+
640
+ The following example shows a ``dropIndexes`` event:
641
+
642
+ .. code-block:: text
643
+
644
+ {
645
+ _id: { <ResumeToken> },
646
+ operationType: 'dropIndexes',
647
+ clusterTime: <Timestamp>
648
+ collectionUUID: <uuid>,
649
+ wallTime: <isodate>,
650
+ ns: {
651
+ db: 'test',
652
+ coll: 'authors' },
653
+ operationDescription: {
654
+ indexes: [
655
+ { v: 2, key: { name: 1 }, name: 'name_1' }
656
+ ]
657
+ }
658
+ }
0 commit comments