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

Function connect

src/cmap/connect.ts:43–54  ·  view source on GitHub ↗
(options: ConnectionOptions)

Source from the content-addressed store, hash-verified

41}
42
43export async function connect(options: ConnectionOptions): Promise<Connection> {
44 let connection: Connection | null = null;
45 try {
46 const socket = await makeSocket(options);
47 connection = makeConnection(options, socket);
48 await performInitialHandshake(connection, options);
49 return connection;
50 } catch (error) {
51 connection?.destroy();
52 throw error;
53 }
54}
55
56export function makeConnection(options: ConnectionOptions, socket: Stream): Connection {
57 let ConnectionType = options.connectionType ?? Connection;

Callers 5

createConnectionMethod · 0.90
measureRoundTripTimeMethod · 0.90
connection.test.tsFile · 0.85
connect.test.tsFile · 0.85
connection.test.tsFile · 0.85

Calls 4

makeSocketFunction · 0.85
makeConnectionFunction · 0.85
performInitialHandshakeFunction · 0.85
destroyMethod · 0.45

Tested by

no test coverage detected