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

Function executeHandshake

src/cmap/connect.ts:190–209  ·  view source on GitHub ↗
(handshakeDoc: Document, handshakeOptions: CommandOptions)

Source from the content-addressed store, hash-verified

188 conn.established = true;
189
190 async function executeHandshake(handshakeDoc: Document, handshakeOptions: CommandOptions) {
191 try {
192 const handshakeResponse = await conn.command(
193 ns('admin.$cmd'),
194 handshakeDoc,
195 handshakeOptions
196 );
197 return handshakeResponse;
198 } catch (error) {
199 if (error instanceof MongoError) {
200 error.addErrorLabel(MongoErrorLabel.HandshakeError);
201 }
202 // If we encounter a network error executing the initial handshake, apply backpressure labels.
203 if (error instanceof MongoNetworkError) {
204 applyBackpressureLabels(error);
205 }
206
207 throw error;
208 }
209 }
210}
211
212/**

Callers 1

performInitialHandshakeFunction · 0.85

Calls 4

nsFunction · 0.90
applyBackpressureLabelsFunction · 0.85
addErrorLabelMethod · 0.80
commandMethod · 0.45

Tested by

no test coverage detected