Skip to content

Commit 5fc176c

Browse files
committed
test: add wallTime tests
1 parent 1e9b269 commit 5fc176c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/change_stream.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export interface ChangeStreamDocumentCommon {
187187
* The server date and time of the database operation.
188188
* wallTime differs from clusterTime in that clusterTime is a timestamp taken from the oplog entry associated with the database operation event.
189189
* The format is "YYYY-MM-DD HH:MM.SS.millis".
190+
* @sinceServerVersion 6.0.0
190191
*/
191192
wallTime?: string;
192193

test/integration/change-streams/change_stream.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,8 @@ describe('Change Streams', function () {
12591259
// Running on replicaset because other topologies are finiky with the cluster-wide events
12601260
// Dropping and renaming and creating collections in order to achieve a clean slate isn't worth the goal of these tests
12611261
// We just want to show that the new ChangeStreamDocument type information can reproduced in a real env
1262-
topologies: ['replicaset']
1262+
topologies: ['replicaset'],
1263+
minServerVersion: '6.0'
12631264
})
12641265
.createEntities([
12651266
{ client: { id: 'client0' } },
@@ -1325,6 +1326,7 @@ describe('Change Streams', function () {
13251326
operationType: 'drop',
13261327
ns: { db: 'dbToDrop', coll: 'collInDbToDrop' },
13271328
clusterTime: { $$type: 'timestamp' },
1329+
wallTime: { $$type: 'date' },
13281330
txnNumber: { $$exists: false },
13291331
lsid: { $$exists: false }
13301332
}
@@ -1337,6 +1339,7 @@ describe('Change Streams', function () {
13371339
operationType: 'dropDatabase',
13381340
ns: { db: 'dbToDrop', coll: { $$exists: false } },
13391341
clusterTime: { $$type: 'timestamp' },
1342+
wallTime: { $$type: 'date' },
13401343
txnNumber: { $$exists: false },
13411344
lsid: { $$exists: false }
13421345
}
@@ -1349,6 +1352,7 @@ describe('Change Streams', function () {
13491352
operationType: 'drop',
13501353
ns: { db: 'dbToDrop', coll: 'collInDbToDrop' },
13511354
clusterTime: { $$type: 'timestamp' },
1355+
wallTime: { $$type: 'date' },
13521356
txnNumber: { $$exists: false },
13531357
lsid: { $$exists: false }
13541358
}
@@ -1360,6 +1364,7 @@ describe('Change Streams', function () {
13601364
_id: { $$exists: true },
13611365
operationType: 'invalidate',
13621366
clusterTime: { $$type: 'timestamp' },
1367+
wallTime: { $$type: 'date' },
13631368
txnNumber: { $$exists: false },
13641369
lsid: { $$exists: false }
13651370
}
@@ -1420,6 +1425,7 @@ describe('Change Streams', function () {
14201425
documentKey: { _id: 3 },
14211426
ns: { db: 'changeStreamDocShape', coll: 'collection0' },
14221427
clusterTime: { $$type: 'timestamp' },
1428+
wallTime: { $$type: 'date' },
14231429
txnNumber: { $$type: ['long', 'int'] },
14241430
lsid: { $$sessionLsid: 'session0' }
14251431
}
@@ -1472,6 +1478,7 @@ describe('Change Streams', function () {
14721478
documentKey: { _id: 3 },
14731479
ns: { db: 'renameDb', coll: 'collToRename' },
14741480
clusterTime: { $$type: 'timestamp' },
1481+
wallTime: { $$type: 'date' },
14751482
txnNumber: { $$exists: false },
14761483
lsid: { $$exists: false }
14771484
}
@@ -1497,6 +1504,7 @@ describe('Change Streams', function () {
14971504
ns: { db: 'renameDb', coll: 'collToRename' },
14981505
to: { db: 'renameDb', coll: 'newCollectionName' },
14991506
clusterTime: { $$type: 'timestamp' },
1507+
wallTime: { $$type: 'date' },
15001508
txnNumber: { $$exists: false },
15011509
lsid: { $$exists: false }
15021510
}

0 commit comments

Comments
 (0)