You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/mongo_client.ts
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -656,13 +656,16 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
656
656
/**
657
657
* Cleans up resources managed by the MongoClient.
658
658
*
659
-
* The close method clears and closes all resources that the client is responsible for.
660
-
* Please refer to the `MongoClient` class documentation for a breakdown of resource responsibilities.
659
+
* The close method clears and closes all resources whose lifetimes are managed by the MongoClient.
660
+
* Please refer to the `MongoClient` class documentation for a high level overview of the client's key features and responsibilities.
661
661
*
662
-
* **However,** the close method is not a replacement for clean up of explicitly created resources.
662
+
* **However,** the close method does not handle the cleanup of resources explicitly created by the user.
663
+
* Any user-created driver resource with its own `close()` method should be explicitly closed by the user before calling MongoClient.close().
663
664
* This method is written as a "best effort" attempt to leave behind the least amount of resources server-side when possible.
664
665
*
665
666
* The following list defines ideal preconditions and consequent pitfalls if they are not met.
667
+
* The MongoClient, ClientSession, Cursors and ChangeStreams all support [explicit resource management](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html).
668
+
* By using explicit resource management to manage the lifetime of driver resources instead of manually managing their lifetimes, the pitfalls outlined below can be avoided.
666
669
*
667
670
* The close method performs the following in the order listed:
0 commit comments