Skip to content

Commit cb5465f

Browse files
committed
fix: type
1 parent 7c4d9f3 commit cb5465f

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

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

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,26 @@ describe('Change Streams', function () {
170170
}
171171
});
172172

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+
173193
it('should create a ChangeStream on a collection and emit change events', {
174194
metadata: { requires: { topology: 'replicaset' } },
175195
async test() {
@@ -1259,8 +1279,7 @@ describe('Change Streams', function () {
12591279
// Running on replicaset because other topologies are finiky with the cluster-wide events
12601280
// Dropping and renaming and creating collections in order to achieve a clean slate isn't worth the goal of these tests
12611281
// 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']
12641283
})
12651284
.createEntities([
12661285
{ client: { id: 'client0' } },
@@ -1326,7 +1345,6 @@ describe('Change Streams', function () {
13261345
operationType: 'drop',
13271346
ns: { db: 'dbToDrop', coll: 'collInDbToDrop' },
13281347
clusterTime: { $$type: 'timestamp' },
1329-
wallTime: { $$type: 'date' },
13301348
txnNumber: { $$exists: false },
13311349
lsid: { $$exists: false }
13321350
}
@@ -1339,7 +1357,6 @@ describe('Change Streams', function () {
13391357
operationType: 'dropDatabase',
13401358
ns: { db: 'dbToDrop', coll: { $$exists: false } },
13411359
clusterTime: { $$type: 'timestamp' },
1342-
wallTime: { $$type: 'date' },
13431360
txnNumber: { $$exists: false },
13441361
lsid: { $$exists: false }
13451362
}
@@ -1352,7 +1369,6 @@ describe('Change Streams', function () {
13521369
operationType: 'drop',
13531370
ns: { db: 'dbToDrop', coll: 'collInDbToDrop' },
13541371
clusterTime: { $$type: 'timestamp' },
1355-
wallTime: { $$type: 'date' },
13561372
txnNumber: { $$exists: false },
13571373
lsid: { $$exists: false }
13581374
}
@@ -1364,7 +1380,6 @@ describe('Change Streams', function () {
13641380
_id: { $$exists: true },
13651381
operationType: 'invalidate',
13661382
clusterTime: { $$type: 'timestamp' },
1367-
wallTime: { $$type: 'date' },
13681383
txnNumber: { $$exists: false },
13691384
lsid: { $$exists: false }
13701385
}
@@ -1425,7 +1440,6 @@ describe('Change Streams', function () {
14251440
documentKey: { _id: 3 },
14261441
ns: { db: 'changeStreamDocShape', coll: 'collection0' },
14271442
clusterTime: { $$type: 'timestamp' },
1428-
wallTime: { $$type: 'date' },
14291443
txnNumber: { $$type: ['long', 'int'] },
14301444
lsid: { $$sessionLsid: 'session0' }
14311445
}
@@ -1478,7 +1492,6 @@ describe('Change Streams', function () {
14781492
documentKey: { _id: 3 },
14791493
ns: { db: 'renameDb', coll: 'collToRename' },
14801494
clusterTime: { $$type: 'timestamp' },
1481-
wallTime: { $$type: 'date' },
14821495
txnNumber: { $$exists: false },
14831496
lsid: { $$exists: false }
14841497
}
@@ -1504,7 +1517,6 @@ describe('Change Streams', function () {
15041517
ns: { db: 'renameDb', coll: 'collToRename' },
15051518
to: { db: 'renameDb', coll: 'newCollectionName' },
15061519
clusterTime: { $$type: 'timestamp' },
1507-
wallTime: { $$type: 'date' },
15081520
txnNumber: { $$exists: false },
15091521
lsid: { $$exists: false }
15101522
}

0 commit comments

Comments
 (0)