* Cleans up resources managed by the MongoClient. * * The close method clears and closes all resources whose lifetimes are managed by the MongoClient. * Please refer to the `MongoClient` class documentation for a high level overview of the client's key features and responsibilities. *
(_force = false)
| 741 | * @param _force - currently an unused flag that has no effect. Defaults to `false`. |
| 742 | */ |
| 743 | async close(_force = false): Promise<void> { |
| 744 | if (this.closeLock) { |
| 745 | return await this.closeLock; |
| 746 | } |
| 747 | |
| 748 | try { |
| 749 | this.closeLock = this._close(); |
| 750 | await this.closeLock; |
| 751 | } finally { |
| 752 | // release |
| 753 | this.closeLock = undefined; |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | /* @internal */ |
| 758 | private async _close(): Promise<void> { |