MCPcopy
hub / github.com/mongodb/node-mongodb-native / connect

Method connect

src/mongo_client.ts:597–611  ·  view source on GitHub ↗

* An optional method to verify a handful of assumptions that are generally useful at application boot-time before using a MongoClient. * For detailed information about the connect process see the MongoClient.connect static method documentation. * * @param url - The MongoDB connection string

()

Source from the content-addressed store, hash-verified

595 * @see https://www.mongodb.com/docs/manual/reference/connection-string/
596 */
597 async connect(): Promise<this> {
598 if (this.connectionLock) {
599 return await this.connectionLock;
600 }
601
602 try {
603 this.connectionLock = this._connect();
604 await this.connectionLock;
605 } finally {
606 // release
607 this.connectionLock = undefined;
608 }
609
610 return this;
611 }
612
613 /**
614 * Create a topology to open the connection, must be locked to avoid topology leaks in concurrency scenario.

Callers 9

makeConnectionTestFunction · 0.95
testConnectionFunction · 0.95
runFunction · 0.95
testAggregateFunction · 0.95
testFindOneAndUpdateFunction · 0.95
testBulkWriteFunction · 0.95
runMethod · 0.95
executeSDAMTestFunction · 0.95
topologyConnectMethod · 0.45

Calls 1

_connectMethod · 0.95

Tested by 8

makeConnectionTestFunction · 0.76
testConnectionFunction · 0.76
runFunction · 0.76
testAggregateFunction · 0.76
testFindOneAndUpdateFunction · 0.76
testBulkWriteFunction · 0.76
runMethod · 0.76
executeSDAMTestFunction · 0.76