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

Method createPool

test/tools/cmap_spec_runner.ts:320–344  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

318 }
319
320 createPool(options) {
321 this.pool = new ConnectionPool(this.#server, {
322 ...this.#poolOptions,
323 ...options,
324 hostAddress: this.#hostAddress,
325 serverApi: process.env.MONGODB_API_VERSION
326 ? { version: process.env.MONGODB_API_VERSION }
327 : undefined,
328 metadata: this.#server.topology.client.options.metadata
329 });
330 this.#originalServerPool = this.#server.pool;
331 this.#server.pool = this.pool;
332 ALL_POOL_EVENTS.forEach(eventName => {
333 this.pool.on(eventName, event => {
334 if (this.#injectPoolStats) {
335 event.totalConnectionCount = this.pool.totalConnectionCount;
336 event.availableConnectionCount = this.pool.availableConnectionCount;
337 event.pendingConnectionCount = this.pool.pendingConnectionCount;
338 event.currentCheckedOutCount = this.pool.currentCheckedOutCount;
339 }
340 this.poolEvents.push(event);
341 this.poolEventsEventEmitter.emit('poolEvent');
342 });
343 });
344 }
345
346 closePool() {
347 this.#server.pool = this.#originalServerPool;

Callers 1

runCmapTestFunction · 0.80

Calls 3

onMethod · 0.80
emitMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected