File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -554,6 +554,7 @@ export class ChangeStream<
554
554
/**
555
555
* @beta
556
556
* @experimental
557
+ * An alias for {@link ChangeStream.close|ChangeStream.close()}.
557
558
*/
558
559
declare [ Symbol . asyncDispose ] : ( ) => Promise < void > ;
559
560
/** @internal */
@@ -779,7 +780,9 @@ export class ChangeStream<
779
780
return this [ kClosed ] || this . cursor . closed ;
780
781
}
781
782
782
- /** Close the Change Stream */
783
+ /**
784
+ * Frees the internal resources used by the change stream.
785
+ */
783
786
async close ( ) : Promise < void > {
784
787
this [ kClosed ] = true ;
785
788
Original file line number Diff line number Diff line change @@ -282,6 +282,7 @@ export abstract class AbstractCursor<
282
282
/**
283
283
* @beta
284
284
* @experimental
285
+ * An alias for {@link AbstractCursor.close|AbstractCursor.close()}.
285
286
*/
286
287
declare [ Symbol . asyncDispose ] : ( ) => Promise < void > ;
287
288
/** @internal */
@@ -460,6 +461,9 @@ export abstract class AbstractCursor<
460
461
}
461
462
}
462
463
464
+ /**
465
+ * Frees any client-side resources used by the cursor.
466
+ */
463
467
async close ( ) : Promise < void > {
464
468
await this . cleanup ( ) ;
465
469
}
Original file line number Diff line number Diff line change @@ -408,6 +408,7 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
408
408
/**
409
409
* @beta
410
410
* @experimental
411
+ * An alias for {@link MongoClient.close|MongoClient.close()}.
411
412
*/
412
413
declare [ Symbol . asyncDispose ] : ( ) => Promise < void > ;
413
414
/** @internal */
@@ -581,7 +582,15 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
581
582
}
582
583
583
584
/**
584
- * Close the client and its underlying connections
585
+ * Cleans up client-side resources used by the MongoCLient and . This includes:
586
+ *
587
+ * - Closes all open, unused connections (see note).
588
+ * - Ends all in-use sessions with {@link ClientSession#endSession|ClientSession.endSession()}.
589
+ * - Ends all unused sessions server-side.
590
+ * - Cleans up any resources being used for auto encryption if auto encryption is enabled.
591
+ *
592
+ * @remarks Any in-progress operations are not killed and any connections used by in progress operations
593
+ * will be cleaned up lazily as operations finish.
585
594
*
586
595
* @param force - Force close, emitting no events
587
596
*/
Original file line number Diff line number Diff line change @@ -259,7 +259,10 @@ export class ClientSession
259
259
}
260
260
261
261
/**
262
- * Ends this session on the server
262
+ * Frees any client-side resources held by the current session. If a session is in a transaction,
263
+ * the transaction is aborted.
264
+ *
265
+ * Does not end the session on the server.
263
266
*
264
267
* @param options - Optional settings. Currently reserved for future use
265
268
*/
@@ -293,6 +296,7 @@ export class ClientSession
293
296
/**
294
297
* @beta
295
298
* @experimental
299
+ * An alias for {@link ClientSession.endSession|ClientSession.endSession()}.
296
300
*/
297
301
declare [ Symbol . asyncDispose ] : ( ) => Promise < void > ;
298
302
/** @internal */
You can’t perform that action at this time.
0 commit comments