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

Function makeConnectionTest

test/manual/tls_support.test.ts:283–300  ·  view source on GitHub ↗
(
  connectionString: string,
  uriOptions: Record<string, any>,
  clientOptions?: MongoClientOptions
)

Source from the content-addressed store, hash-verified

281});
282
283function makeConnectionTest(
284 connectionString: string,
285 uriOptions: Record<string, any>,
286 clientOptions?: MongoClientOptions
287) {
288 const uri = new ConnectionString(connectionString);
289 for (const [k, v] of Object.entries(uriOptions)) {
290 uri.searchParams.set(k, v);
291 }
292 return async function () {
293 const client = new MongoClient(uri.toString(), clientOptions);
294
295 await client.connect();
296 await client.db('admin').command({ [LEGACY_HELLO_COMMAND]: 1 });
297 await client.db('test').collection('test').findOne({});
298 return await client.close();
299 };
300}

Callers 1

Calls 8

connectMethod · 0.95
dbMethod · 0.95
closeMethod · 0.95
setMethod · 0.80
findOneMethod · 0.80
collectionMethod · 0.65
toStringMethod · 0.45
commandMethod · 0.45

Tested by

no test coverage detected