Skip to content

Commit ceb4f60

Browse files
committed
fix: walltime only where included
1 parent 1530f4c commit ceb4f60

File tree

1 file changed

+38
-21
lines changed

1 file changed

+38
-21
lines changed

src/change_stream.ts

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,6 @@ export interface ChangeStreamDocumentCommon {
183183
*/
184184
clusterTime?: Timestamp;
185185

186-
/**
187-
* The server date and time of the database operation.
188-
* wallTime differs from clusterTime in that clusterTime is a timestamp taken from the oplog entry associated with the database operation event.
189-
* The format is "YYYY-MM-DD HH:MM.SS.millis".
190-
* @sinceServerVersion 6.0.0
191-
*/
192-
wallTime?: Date;
193-
194186
/**
195187
* The transaction number.
196188
* Only present if the operation is part of a multi-document transaction.
@@ -213,6 +205,16 @@ export interface ChangeStreamDocumentCommon {
213205
splitEvent?: ChangeStreamSplitEvent;
214206
}
215207

208+
/** @public */
209+
export interface ChangeStreamDocumentWallTime {
210+
/**
211+
* The server date and time of the database operation.
212+
* wallTime differs from clusterTime in that clusterTime is a timestamp taken from the oplog entry associated with the database operation event.
213+
* @sinceServerVersion 6.0.0
214+
*/
215+
wallTime?: Date;
216+
}
217+
216218
/** @public */
217219
export interface ChangeStreamDocumentCollectionUUID {
218220
/**
@@ -247,7 +249,8 @@ export interface ChangeStreamDocumentOperationDescription {
247249
export interface ChangeStreamInsertDocument<TSchema extends Document = Document>
248250
extends ChangeStreamDocumentCommon,
249251
ChangeStreamDocumentKey<TSchema>,
250-
ChangeStreamDocumentCollectionUUID {
252+
ChangeStreamDocumentCollectionUUID,
253+
ChangeStreamDocumentWallTime {
251254
/** Describes the type of operation represented in this change notification */
252255
operationType: 'insert';
253256
/** This key will contain the document being inserted */
@@ -263,7 +266,8 @@ export interface ChangeStreamInsertDocument<TSchema extends Document = Document>
263266
export interface ChangeStreamUpdateDocument<TSchema extends Document = Document>
264267
extends ChangeStreamDocumentCommon,
265268
ChangeStreamDocumentKey<TSchema>,
266-
ChangeStreamDocumentCollectionUUID {
269+
ChangeStreamDocumentCollectionUUID,
270+
ChangeStreamDocumentWallTime {
267271
/** Describes the type of operation represented in this change notification */
268272
operationType: 'update';
269273
/**
@@ -293,7 +297,8 @@ export interface ChangeStreamUpdateDocument<TSchema extends Document = Document>
293297
*/
294298
export interface ChangeStreamReplaceDocument<TSchema extends Document = Document>
295299
extends ChangeStreamDocumentCommon,
296-
ChangeStreamDocumentKey<TSchema> {
300+
ChangeStreamDocumentKey<TSchema>,
301+
ChangeStreamDocumentWallTime {
297302
/** Describes the type of operation represented in this change notification */
298303
operationType: 'replace';
299304
/** The fullDocument of a replace event represents the document after the insert of the replacement document */
@@ -317,7 +322,8 @@ export interface ChangeStreamReplaceDocument<TSchema extends Document = Document
317322
export interface ChangeStreamDeleteDocument<TSchema extends Document = Document>
318323
extends ChangeStreamDocumentCommon,
319324
ChangeStreamDocumentKey<TSchema>,
320-
ChangeStreamDocumentCollectionUUID {
325+
ChangeStreamDocumentCollectionUUID,
326+
ChangeStreamDocumentWallTime {
321327
/** Describes the type of operation represented in this change notification */
322328
operationType: 'delete';
323329
/** Namespace the delete event occurred on */
@@ -338,7 +344,8 @@ export interface ChangeStreamDeleteDocument<TSchema extends Document = Document>
338344
*/
339345
export interface ChangeStreamDropDocument
340346
extends ChangeStreamDocumentCommon,
341-
ChangeStreamDocumentCollectionUUID {
347+
ChangeStreamDocumentCollectionUUID,
348+
ChangeStreamDocumentWallTime {
342349
/** Describes the type of operation represented in this change notification */
343350
operationType: 'drop';
344351
/** Namespace the drop event occurred on */
@@ -351,7 +358,8 @@ export interface ChangeStreamDropDocument
351358
*/
352359
export interface ChangeStreamRenameDocument
353360
extends ChangeStreamDocumentCommon,
354-
ChangeStreamDocumentCollectionUUID {
361+
ChangeStreamDocumentCollectionUUID,
362+
ChangeStreamDocumentWallTime {
355363
/** Describes the type of operation represented in this change notification */
356364
operationType: 'rename';
357365
/** The new name for the `ns.coll` collection */
@@ -364,7 +372,9 @@ export interface ChangeStreamRenameDocument
364372
* @public
365373
* @see https://www.mongodb.com/docs/manual/reference/change-events/#dropdatabase-event
366374
*/
367-
export interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCommon {
375+
export interface ChangeStreamDropDatabaseDocument
376+
extends ChangeStreamDocumentCommon,
377+
ChangeStreamDocumentWallTime {
368378
/** Describes the type of operation represented in this change notification */
369379
operationType: 'dropDatabase';
370380
/** The database dropped */
@@ -375,7 +385,9 @@ export interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCo
375385
* @public
376386
* @see https://www.mongodb.com/docs/manual/reference/change-events/#invalidate-event
377387
*/
378-
export interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentCommon {
388+
export interface ChangeStreamInvalidateDocument
389+
extends ChangeStreamDocumentCommon,
390+
ChangeStreamDocumentWallTime {
379391
/** Describes the type of operation represented in this change notification */
380392
operationType: 'invalidate';
381393
}
@@ -388,7 +400,8 @@ export interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentComm
388400
export interface ChangeStreamCreateIndexDocument
389401
extends ChangeStreamDocumentCommon,
390402
ChangeStreamDocumentCollectionUUID,
391-
ChangeStreamDocumentOperationDescription {
403+
ChangeStreamDocumentOperationDescription,
404+
ChangeStreamDocumentWallTime {
392405
/** Describes the type of operation represented in this change notification */
393406
operationType: 'createIndexes';
394407
}
@@ -401,7 +414,8 @@ export interface ChangeStreamCreateIndexDocument
401414
export interface ChangeStreamDropIndexDocument
402415
extends ChangeStreamDocumentCommon,
403416
ChangeStreamDocumentCollectionUUID,
404-
ChangeStreamDocumentOperationDescription {
417+
ChangeStreamDocumentOperationDescription,
418+
ChangeStreamDocumentWallTime {
405419
/** Describes the type of operation represented in this change notification */
406420
operationType: 'dropIndexes';
407421
}
@@ -413,7 +427,8 @@ export interface ChangeStreamDropIndexDocument
413427
*/
414428
export interface ChangeStreamCollModDocument
415429
extends ChangeStreamDocumentCommon,
416-
ChangeStreamDocumentCollectionUUID {
430+
ChangeStreamDocumentCollectionUUID,
431+
ChangeStreamDocumentWallTime {
417432
/** Describes the type of operation represented in this change notification */
418433
operationType: 'modify';
419434
}
@@ -424,7 +439,8 @@ export interface ChangeStreamCollModDocument
424439
*/
425440
export interface ChangeStreamCreateDocument
426441
extends ChangeStreamDocumentCommon,
427-
ChangeStreamDocumentCollectionUUID {
442+
ChangeStreamDocumentCollectionUUID,
443+
ChangeStreamDocumentWallTime {
428444
/** Describes the type of operation represented in this change notification */
429445
operationType: 'create';
430446

@@ -443,7 +459,8 @@ export interface ChangeStreamCreateDocument
443459
export interface ChangeStreamShardCollectionDocument
444460
extends ChangeStreamDocumentCommon,
445461
ChangeStreamDocumentCollectionUUID,
446-
ChangeStreamDocumentOperationDescription {
462+
ChangeStreamDocumentOperationDescription,
463+
ChangeStreamDocumentWallTime {
447464
/** Describes the type of operation represented in this change notification */
448465
operationType: 'shardCollection';
449466
}

0 commit comments

Comments
 (0)