Skip to content

Commit ca25ee4

Browse files
(DOCSP-20825) Connection Defaults (#213)
1 parent 0e9d3d3 commit ca25ee4

File tree

1 file changed

+90
-17
lines changed

1 file changed

+90
-17
lines changed

source/fundamentals/connection/connection-options.txt

Lines changed: 90 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,51 +21,69 @@ parameters of the connection URI to specify the behavior of the client.
2121
- Specifies the minimum number of connections that must exist at
2222
any moment in a single connection pool.
2323

24+
| **Default**: ``0``
25+
2426
* - **maxPoolSize**
2527
- integer
2628
- Specifies the maximum number of connections that a connection
2729
pool may have at a given time.
2830

31+
| **Default**: ``100``
32+
2933
* - **waitQueueTimeoutMS**
3034
- integer
3135
- Specifies the maximum amount of time, in milliseconds that a
3236
thread may wait for a connection to become available.
3337

38+
| **Default**: ``120000`` (120 seconds)
39+
3440
* - **serverSelectionTimeoutMS**
3541
- integer
3642
- Specifies the maximum amount of time, in milliseconds, the driver
3743
will wait for server selection to succeed before throwing an
3844
exception.
3945

46+
| **Default**: ``30000`` (30 seconds)
47+
4048
* - **localThresholdMS**
4149
- integer
4250
- When communicating with multiple instances of MongoDB in a replica
4351
set, the driver will only send requests to a server whose
4452
response time is less than or equal to the server with the fastest
4553
response time plus the local threshold, in milliseconds.
4654

55+
| **Default**: ``15``
56+
4757
* - **heartbeatFrequencyMS**
4858
- integer
4959
- Specifies the frequency, in milliseconds that the driver will
5060
wait between attempts to determine the current state of each
5161
server in the cluster.
5262

63+
| **Default**: ``10000`` (10 seconds)
64+
5365
* - **replicaSet**
5466
- string
5567
- Specifies that the :ref:`connection string <connection-uri>`
5668
provided includes multiple hosts. When specified, the driver
5769
attempts to find all members of that set.
5870

71+
| **Default**: ``null``
72+
5973
* - **ssl**
6074
- boolean
6175
- Specifies that all communication with MongoDB instances should
6276
use TLS/SSL. Superseded by the **tls** option.
6377

78+
| **Default**: ``false``
79+
6480
* - **tls**
6581
- boolean
6682
- Specifies that all communication with MongoDB instances should
6783
use TLS. Supersedes the **ssl** option.
6884

85+
| **Default**: ``false``
86+
6987
* - **tlsInsecure**
7088
- boolean
7189
- Specifies that the driver should allow invalid hostnames for TLS
@@ -74,87 +92,122 @@ parameters of the connection URI to specify the behavior of the client.
7492
constraints in other ways, use a
7593
:ref:`custom SSLContext <tls-custom-sslContext>`.
7694

95+
| **Default**: ``false``
96+
7797
* - **tlsAllowInvalidHostnames**
7898
- boolean
7999
- Specifies that the driver should allow invalid hostnames in the
80100
certificate for TLS connections. Supersedes
81101
**sslInvalidHostNameAllowed**.
82102

103+
| **Default**: ``false``
104+
83105
* - **connectTimeoutMS**
84106
- integer
85107
- Specifies the maximum amount of time, in milliseconds, the Java
86-
driver waits for a connection to open before timing out.
108+
driver waits for a connection to open before timing out. A value of
109+
``0`` instructs the driver to never time out while waiting for a connection
110+
to open.
111+
112+
| **Default**: ``10000`` (10 seconds)
87113

88114
* - **socketTimeoutMS**
89115
- integer
90116
- Specifies the maximum amount of time, in milliseconds, the Java
91117
driver will wait to send or receive a request before timing out.
118+
A value of ``0`` instructs the driver to never time out while waiting
119+
to send or receive a request.
120+
121+
| **Default**: ``0``
92122

93123
* - **maxIdleTimeMS**
94124
- integer
95125
- Specifies the maximum amount of time, in milliseconds, the Java
96126
driver will allow a pooled connection to idle before closing the
97-
connection.
127+
connection. A value of ``0`` indicates that there is no upper bound
128+
on how long the driver can allow a pooled collection to be idle.
129+
130+
| **Default**: ``0``
98131

99132
* - **maxLifeTimeMS**
100133
- integer
101134
- Specifies the maximum amount of time, in milliseconds, the Java
102135
driver will continue to use a pooled connection before closing the
103-
connection.
136+
connection. A value of ``0`` indicates that there is no upper bound
137+
on how long the driver can keep a pooled connection open.
138+
139+
| **Default**: ``0``
104140

105141
* - **journal**
106142
- boolean
107143
- Specifies that the driver must wait for the connected MongoDB
108144
instance to group commit to the journal file on disk for all writes.
109145

146+
| **Default**: ``false``
147+
110148
* - **w**
111149
- string or integer
112150
- Specifies the write concern. For more information on values, see
113151
the server documentation for the :manual:`w option
114152
</reference/write-concern/#w-option>`.
115153

154+
| **Default**: ``1``
155+
116156
* - **wtimeoutMS**
117157
- integer
118158
- Specifies a time limit, in milliseconds, for the write concern. For
119159
more information, see the server documentation for the
120160
:manual:`wtimeoutMS option </reference/connection-string/#write-concern-options>`.
161+
A value of ``0`` instructs the driver to never time out write operations.
162+
163+
| **Default**: ``0``
121164

122165
* - **readPreference**
123166
- string
124167
- Specifies the read preference. For more information on values, see
125168
the server documentation for the
126169
:manual:`readPreference option </reference/connection-string/#urioption.readPreference>`.
127170

171+
| **Default**: ``primary``
172+
128173
* - **readPreferenceTags**
129174
- string
130175
- Specifies the read preference tags. For more information on values, see
131176
the server documentation for the
132177
:manual:`readPreferenceTags option </reference/connection-string/#urioption.readPreferenceTags>`.
133178

179+
| **Default**: ``null``
180+
134181
* - **maxStalenessSeconds**
135182
- integer
136183
- Specifies, in seconds, how stale a secondary can be before the
137-
driver stops communicating with that secondary. Not providing
138-
a parameter or explicitly setting it to ``-1`` indicates that there
139-
should be no staleness check for secondaries. The minimum value is
184+
driver stops communicating with that secondary. The minimum value is
140185
either 90 seconds or the heartbeat frequency plus 10 seconds, whichever
141186
is greater. For more information, see the server documentation for the
142187
:manual:`maxStalenessSeconds option </reference/connection-string/#urioption.maxStalenessSeconds>`.
188+
Not providing a parameter or explicitly specifying ``-1`` indicates
189+
that there should be no staleness check for secondaries.
190+
191+
| **Default**: ``-1``
143192

144193
* - **authMechanism**
145194
- string
146195
- Specifies the :doc:`authentication mechanism
147196
</fundamentals/auth>` that the driver should use if a credential
148-
was supplied. By default, the client picks the most secure
149-
mechanism available based on the server version. For possible
150-
values, see the server documentation for the
151-
:manual:`authMechanism option
152-
</reference/connection-string/#urioption.authMechanism>`.
197+
was supplied.
198+
199+
| **Default**: By default, the client picks the most secure
200+
mechanism available based on the server version. For possible
201+
values, see the server documentation for the
202+
:manual:`authMechanism option
203+
</reference/connection-string/#urioption.authMechanism>`.
153204

154205
* - **authSource**
155206
- string
156207
- Specifies the database that the supplied credentials should be
157-
validated against. Defaults to ``admin``.
208+
validated against.
209+
210+
| **Default**: ``admin``
158211

159212
* - **authMechanismProperties**
160213
- string
@@ -164,19 +217,25 @@ parameters of the connection URI to specify the behavior of the client.
164217
the :manual:`authMechanismProperties option
165218
</reference/connection-string/#urioption.authMechanismProperties>`.
166219

220+
| **Default**: ``null``
221+
167222
* - **appName**
168223
- string
169224
- Specifies the name of the application provided to MongoDB instances
170225
during the connection handshake. Can be used for server logs and
171226
profiling.
172227

228+
| **Default**: ``null``
229+
173230
* - **compressors**
174231
- string
175232
- Specifies one or more compression algorithms that the driver
176233
will attempt to use to compress requests sent to the connected
177234
MongoDB instance. Possible values include: ``zlib``, ``snappy``,
178235
and ``zstd``.
179236

237+
| **Default**: ``null``
238+
180239
* - **zlibCompressionLevel**
181240
- integer
182241
- Specifies the degree of compression that `Zlib <https://zlib.net/>`__
@@ -185,15 +244,22 @@ parameters of the connection URI to specify the behavior of the client.
185244
compressing faster (but resulting in larger requests) and larger values
186245
compressing slower (but resulting in smaller requests).
187246

247+
| **Default**: ``null``
248+
188249
* - **retryWrites**
189250
- boolean
190251
- Specifies that the driver must retry supported write operations
191-
if they fail due to a network error. Defaults to ``true``.
252+
if they fail due to a network error.
253+
254+
| **Default**: ``true``
255+
192256

193257
* - **retryReads**
194258
- boolean
195259
- Specifies that the driver must retry supported read operations
196-
if they fail due to a network error. Defaults to ``true``.
260+
if they fail due to a network error.
261+
262+
| **Default**: ``true``
197263

198264
* - **uuidRepresentation**
199265
- string
@@ -202,14 +268,20 @@ parameters of the connection URI to specify the behavior of the client.
202268
for the
203269
`MongoClientSettings.getUuidRepresentation() method <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.html#getUuidRepresentation()>`__.
204270

271+
| **Default**: ``unspecified``
272+
205273
* - **directConnection**
206274
- boolean
207275
- Specifies that the driver must connect to the host directly.
208276

277+
| **Default**: ``false``
278+
209279
* - **maxConnecting**
210280
- integer
211281
- Specifies the maximum number of connections a pool may be establishing
212-
concurrently. Defaults to ``2``.
282+
concurrently.
283+
284+
| **Default**: ``2``
213285

214286
* - **srvServiceName**
215287
- string
@@ -221,8 +293,9 @@ parameters of the connection URI to specify the behavior of the client.
221293
:manual:`DNS Seed List Connection Format </reference/connection-string/#dns-seed-list-connection-format>`
222294
in your
223295
:ref:`connection URI <connection-uri>`
224-
to use this option. Defaults to ``"mongodb"``.
225-
296+
to use this option.
297+
298+
| **Default**: ``mongodb``
226299

227300
For a complete list of options, see the
228301
`ConnectionString <{+api+}/apidocs/mongodb-driver-core/com/mongodb/ConnectionString.html>`__

0 commit comments

Comments
 (0)