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

Method constructor

src/cmap/connection.ts:233–258  ·  view source on GitHub ↗
(stream: Stream, options: ConnectionOptions)

Source from the content-addressed store, hash-verified

231 static readonly UNPINNED = UNPINNED;
232
233 constructor(stream: Stream, options: ConnectionOptions) {
234 super();
235 this.on('error', noop);
236
237 this.socket = stream;
238 this.id = options.id;
239 this.address = streamIdentifier(stream, options);
240 this.socketTimeoutMS = options.socketTimeoutMS ?? 0;
241 this.monitorCommands = options.monitorCommands;
242 this.serverApi = options.serverApi;
243 this.mongoLogger = options.mongoLogger;
244 this.established = false;
245
246 this.description = new StreamDescription(this.address, options);
247 this.generation = options.generation;
248 this.lastUseTime = processTimeMS();
249
250 this.messageStream = this.socket
251 .on('error', this.onSocketError.bind(this))
252 .pipe(new SizedMessageTransform({ connection: this }))
253 .on('error', this.onTransformError.bind(this));
254 this.socket.on('close', this.onClose.bind(this));
255 this.socket.on('timeout', this.onTimeout.bind(this));
256
257 this.messageStream.pause();
258 }
259
260 public get hello() {
261 return this.description.hello;

Callers

nothing calls this directly

Calls 3

processTimeMSFunction · 0.90
streamIdentifierFunction · 0.85
onMethod · 0.80

Tested by

no test coverage detected