Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 089773f

Browse files
committedApr 4, 2025··
wip
1 parent d5b4d55 commit 089773f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed
 

‎src/mongo_client.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,9 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
636636
}
637637

638638
/**
639-
* Cleans up client-side resources used by the MongoCLient and . This includes:
639+
* Cleans up client-side resources used by the MongoClient.
640+
*
641+
* This includes:
640642
*
641643
* - Closes all open, unused connections (see note).
642644
* - Ends all in-use sessions with {@link ClientSession#endSession|ClientSession.endSession()}.

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

+8-3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ describe('Change Streams', function () {
6363
await csDb.createCollection('test').catch(() => null);
6464
collection = csDb.collection('test');
6565
changeStream = collection.watch();
66+
changeStream.on('error', () => null);
6667
});
6768

6869
afterEach(async () => {
@@ -702,15 +703,19 @@ describe('Change Streams', function () {
702703

703704
const outStream = new PassThrough({ objectMode: true });
704705

705-
// @ts-expect-error: transform requires a Document return type
706-
changeStream.stream({ transform: JSON.stringify }).pipe(outStream);
706+
const transform = doc => ({ doc: JSON.stringify(doc) });
707+
changeStream
708+
.stream({ transform })
709+
.on('error', () => null)
710+
.pipe(outStream)
711+
.on('error', () => null);
707712

708713
const willBeData = once(outStream, 'data');
709714

710715
await collection.insertMany([{ a: 1 }]);
711716

712717
const [data] = await willBeData;
713-
const parsedEvent = JSON.parse(data);
718+
const parsedEvent = JSON.parse(data.doc);
714719
expect(parsedEvent).to.have.nested.property('fullDocument.a', 1);
715720

716721
outStream.destroy();

0 commit comments

Comments
 (0)
Please sign in to comment.