Skip to content

Commit 6f3048c

Browse files
committed
doc: document options supported by the new CMAP connection pool
NODE-2637
1 parent 1f855a4 commit 6f3048c

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

lib/mongo_client.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ const validOptions = require('./operations/connect').validOptions;
146146
* @param {Number} [options.localThresholdMS=15] **Only applies to the unified topology** The size of the latency window for selecting among multiple suitable servers
147147
* @param {Number} [options.serverSelectionTimeoutMS=30000] **Only applies to the unified topology** How long to block for server selection before throwing an error
148148
* @param {Number} [options.heartbeatFrequencyMS=10000] **Only applies to the unified topology** The frequency with which topology updates are scheduled
149+
* @param {number} [options.maxPoolSize=10] **Only applies to the unified topology** The maximum number of connections that may be associated with a pool at a given time. This includes in use and available connections.
150+
* @param {number} [options.minPoolSize=0] **Only applies to the unified topology** The minimum number of connections that MUST exist at any moment in a single connection pool.
151+
* @param {number} [options.maxIdleTimeMS] **Only applies to the unified topology** The maximum amount of time a connection should remain idle in the connection pool before being marked idle. The default is infinity.
152+
* @param {number} [options.waitQueueTimeoutMS=0] **Only applies to the unified topology** The maximum amount of time operation execution should wait for a connection to become available. The default is 0 which means there is no limit.
149153
* @param {AutoEncrypter~AutoEncryptionOptions} [options.autoEncryption] Optionally enable client side auto encryption
150154
* @param {DriverInfoOptions} [options.driverInfo] Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver
151155
* @param {MongoClient~connectCallback} [callback] The command result callback
@@ -415,6 +419,10 @@ MongoClient.prototype.isConnected = function(options) {
415419
* @param {Number} [options.localThresholdMS=15] **Only applies to the unified topology** The size of the latency window for selecting among multiple suitable servers
416420
* @param {Number} [options.serverSelectionTimeoutMS=30000] **Only applies to the unified topology** How long to block for server selection before throwing an error
417421
* @param {Number} [options.heartbeatFrequencyMS=10000] **Only applies to the unified topology** The frequency with which topology updates are scheduled
422+
* @param {number} [options.maxPoolSize=10] **Only applies to the unified topology** The maximum number of connections that may be associated with a pool at a given time. This includes in use and available connections.
423+
* @param {number} [options.minPoolSize=0] **Only applies to the unified topology** The minimum number of connections that MUST exist at any moment in a single connection pool.
424+
* @param {number} [options.maxIdleTimeMS] **Only applies to the unified topology** The maximum amount of time a connection should remain idle in the connection pool before being marked idle. The default is infinity.
425+
* @param {number} [options.waitQueueTimeoutMS=0] **Only applies to the unified topology** The maximum amount of time operation execution should wait for a connection to become available. The default is 0 which means there is no limit.
418426
* @param {AutoEncrypter~AutoEncryptionOptions} [options.autoEncryption] Optionally enable client side auto encryption
419427
* @param {DriverInfoOptions} [options.driverInfo] Allows a wrapping driver to amend the client metadata generated by the driver to include information about the wrapping driver
420428
* @param {MongoClient~connectCallback} [callback] The command result callback

lib/operations/connect.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ const validOptionNames = [
151151
'tlsCertificateKeyFilePassword',
152152
'minHeartbeatFrequencyMS',
153153
'heartbeatFrequencyMS',
154+
155+
// CMAP options
156+
'maxPoolSize',
157+
'minPoolSize',
158+
'maxIdleTimeMS',
154159
'waitQueueTimeoutMS'
155160
];
156161

lib/topologies/native_topology.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@ class NativeTopology extends Topology {
1515
cursorFactory: Cursor,
1616
reconnect: false,
1717
emitError: typeof options.emitError === 'boolean' ? options.emitError : true,
18-
maxPoolSize: typeof options.poolSize === 'number' ? options.poolSize : 5,
19-
minPoolSize: typeof options.minSize === 'number' ? options.minSize : 0,
18+
maxPoolSize:
19+
typeof options.maxPoolSize === 'number'
20+
? options.maxPoolSize
21+
: typeof options.poolSize === 'number'
22+
? options.poolSize
23+
: 10,
24+
minPoolSize:
25+
typeof options.minPoolSize === 'number'
26+
? options.minPoolSize
27+
: typeof options.minSize === 'number'
28+
? options.minSize
29+
: 0,
2030
monitorCommands:
2131
typeof options.monitorCommands === 'boolean' ? options.monitorCommands : false
2232
}

0 commit comments

Comments
 (0)