Skip to content

Commit 67ae727

Browse files
committed
docs(NODE-6223): add documentation about auto-connect and CSOT
1 parent a9298a4 commit 67ae727

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/mongo_client.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,13 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
514514
/**
515515
* Connect to MongoDB using a url
516516
*
517+
* @remarks
518+
* Calling connect is optional as the first operation you preform will call connect if it's needed.
519+
* `timeoutMS` specified at the client-level will bound the time any operation can take before throwing a timeout error.
520+
* However, when the operation being run is automatically connecting your MongoClient the timeoutMS will only be used for the operation portion of task.
521+
* This means the time to setup the MongoClient does not count against timeoutMS.
522+
* If you are using timeoutMS we recommend connecting your client explicitly in advance of any operation to avoid this inconsistent execution time.
523+
*
517524
* @see docs.mongodb.org/manual/reference/connection-string/
518525
*/
519526
async connect(): Promise<this> {
@@ -717,6 +724,13 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
717724
* Connect to MongoDB using a url
718725
*
719726
* @remarks
727+
* Calling connect is optional as the first operation you preform will call connect if it's needed.
728+
* `timeoutMS` specified at the client-level will bound the time any operation can take before throwing a timeout error.
729+
* However, when the operation being run is automatically connecting your MongoClient the timeoutMS will only be used for the operation portion of task.
730+
* This means the time to setup the MongoClient does not count against timeoutMS.
731+
* If you are using timeoutMS we recommend connecting your client explicitly in advance of any operation to avoid this inconsistent execution time.
732+
*
733+
* @remarks
720734
* The programmatically provided options take precedence over the URI options.
721735
*
722736
* @see https://www.mongodb.com/docs/manual/reference/connection-string/

0 commit comments

Comments
 (0)