@@ -170,6 +170,26 @@ describe('Change Streams', function () {
170
170
}
171
171
} ) ;
172
172
173
+ it ( 'contains a wallType date property on the change' , {
174
+ metadata : { requires : { topology : 'replicaset' , mongodb : '>=6.0.0' } } ,
175
+ async test ( ) {
176
+ const collection = db . collection ( 'wallTimeTest' ) ;
177
+ const changeStream = collection . watch ( pipeline ) ;
178
+
179
+ const willBeChanges = on ( changeStream , 'change' ) ;
180
+ await once ( changeStream . cursor , 'init' ) ;
181
+
182
+ await collection . insertOne ( { d : 4 } ) ;
183
+
184
+ const change = ( await willBeChanges . next ( ) ) . value [ 0 ] ;
185
+
186
+ await changeStream . close ( ) ;
187
+
188
+ expect ( change ) . to . have . property ( 'wallTime' ) ;
189
+ expect ( change . wallType ) . to . be . instanceOf ( Date ) ;
190
+ }
191
+ } ) ;
192
+
173
193
it ( 'should create a ChangeStream on a collection and emit change events' , {
174
194
metadata : { requires : { topology : 'replicaset' } } ,
175
195
async test ( ) {
@@ -1259,8 +1279,7 @@ describe('Change Streams', function () {
1259
1279
// Running on replicaset because other topologies are finiky with the cluster-wide events
1260
1280
// Dropping and renaming and creating collections in order to achieve a clean slate isn't worth the goal of these tests
1261
1281
// We just want to show that the new ChangeStreamDocument type information can reproduced in a real env
1262
- topologies : [ 'replicaset' ] ,
1263
- minServerVersion : '6.0'
1282
+ topologies : [ 'replicaset' ]
1264
1283
} )
1265
1284
. createEntities ( [
1266
1285
{ client : { id : 'client0' } } ,
@@ -1326,7 +1345,6 @@ describe('Change Streams', function () {
1326
1345
operationType : 'drop' ,
1327
1346
ns : { db : 'dbToDrop' , coll : 'collInDbToDrop' } ,
1328
1347
clusterTime : { $$type : 'timestamp' } ,
1329
- wallTime : { $$type : 'date' } ,
1330
1348
txnNumber : { $$exists : false } ,
1331
1349
lsid : { $$exists : false }
1332
1350
}
@@ -1339,7 +1357,6 @@ describe('Change Streams', function () {
1339
1357
operationType : 'dropDatabase' ,
1340
1358
ns : { db : 'dbToDrop' , coll : { $$exists : false } } ,
1341
1359
clusterTime : { $$type : 'timestamp' } ,
1342
- wallTime : { $$type : 'date' } ,
1343
1360
txnNumber : { $$exists : false } ,
1344
1361
lsid : { $$exists : false }
1345
1362
}
@@ -1352,7 +1369,6 @@ describe('Change Streams', function () {
1352
1369
operationType : 'drop' ,
1353
1370
ns : { db : 'dbToDrop' , coll : 'collInDbToDrop' } ,
1354
1371
clusterTime : { $$type : 'timestamp' } ,
1355
- wallTime : { $$type : 'date' } ,
1356
1372
txnNumber : { $$exists : false } ,
1357
1373
lsid : { $$exists : false }
1358
1374
}
@@ -1364,7 +1380,6 @@ describe('Change Streams', function () {
1364
1380
_id : { $$exists : true } ,
1365
1381
operationType : 'invalidate' ,
1366
1382
clusterTime : { $$type : 'timestamp' } ,
1367
- wallTime : { $$type : 'date' } ,
1368
1383
txnNumber : { $$exists : false } ,
1369
1384
lsid : { $$exists : false }
1370
1385
}
@@ -1425,7 +1440,6 @@ describe('Change Streams', function () {
1425
1440
documentKey : { _id : 3 } ,
1426
1441
ns : { db : 'changeStreamDocShape' , coll : 'collection0' } ,
1427
1442
clusterTime : { $$type : 'timestamp' } ,
1428
- wallTime : { $$type : 'date' } ,
1429
1443
txnNumber : { $$type : [ 'long' , 'int' ] } ,
1430
1444
lsid : { $$sessionLsid : 'session0' }
1431
1445
}
@@ -1478,7 +1492,6 @@ describe('Change Streams', function () {
1478
1492
documentKey : { _id : 3 } ,
1479
1493
ns : { db : 'renameDb' , coll : 'collToRename' } ,
1480
1494
clusterTime : { $$type : 'timestamp' } ,
1481
- wallTime : { $$type : 'date' } ,
1482
1495
txnNumber : { $$exists : false } ,
1483
1496
lsid : { $$exists : false }
1484
1497
}
@@ -1504,7 +1517,6 @@ describe('Change Streams', function () {
1504
1517
ns : { db : 'renameDb' , coll : 'collToRename' } ,
1505
1518
to : { db : 'renameDb' , coll : 'newCollectionName' } ,
1506
1519
clusterTime : { $$type : 'timestamp' } ,
1507
- wallTime : { $$type : 'date' } ,
1508
1520
txnNumber : { $$exists : false } ,
1509
1521
lsid : { $$exists : false }
1510
1522
}
0 commit comments