@@ -95,12 +95,12 @@ Replica Set Options
95
95
96
96
* - :manual:`directConnection </reference/connection-string/#mongodb-urioption-urioption.directConnection>`
97
97
- {+bool-data-type+}
98
- - | **MongoDB\Client**: ``$uriOptions = [ 'directConnection' => true ];``
98
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'directConnection' => true ];``
99
99
| **Connection URI**: ``directConnection=true``
100
100
101
101
* - :manual:`replicaSet </reference/connection-string/#mongodb-urioption-urioption.replicaSet>`
102
102
- {+string-data-type+}
103
- - | **MongoDB\Client**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];``
103
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];``
104
104
| **Connection URI**: ``replicaSet=replicaSetName``
105
105
106
106
Connection Options
@@ -124,12 +124,12 @@ Timeout Options
124
124
125
125
* - :manual:`connectTimeoutMS </reference/connection-string/#mongodb-urioption-urioption.connecttimeoutms>`
126
126
- {+int-data-type+}
127
- - | **MongoDB\Client**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];``
127
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];``
128
128
| **Connection URI**: ``connectTimeoutMS=20000``
129
129
130
130
* - :manual:`socketTimeoutMS </reference/connection-string/#mongodb-urioption-urioption.sockettimeoutms>`
131
131
- {+int-data-type+}
132
- - | **MongoDB\Client**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];``
132
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];``
133
133
| **Connection URI**: ``socketTimeoutMS=400000``
134
134
135
135
.. _php-compression-options:
@@ -147,12 +147,12 @@ Compression Options
147
147
148
148
* - :manual:`compressors </reference/connection-string/#mongodb-urioption-urioption.compressors>`
149
149
- {+string-data-type+}
150
- - | **MongoDB\Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];``
150
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];``
151
151
| **Connection URI**: ``compressors=snappy,zstd,zlib``
152
152
153
153
* - :manual:`zlibCompressionLevel </reference/connection-string/#mongodb-urioption-urioption.zlibcompressionlevel>`
154
154
- {+int-data-type+}
155
- - | **MongoDB\Client**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];``
155
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];``
156
156
| **Connection URI**: ``zlibCompressionLevel=3``
157
157
158
158
Connection Pool Options
@@ -168,12 +168,12 @@ Connection Pool Options
168
168
169
169
* - :manual:`maxPoolSize </reference/connection-string/#mongodb-urioption-urioption.maxpoolsize>`
170
170
- {+int-data-type+}
171
- - | **MongoDB\Client**: N/A
171
+ - | **MongoDB\\ Client**: N/A
172
172
| **Connection URI**: ``maxPoolSize=75``
173
173
174
174
* - :manual:`waitQueueTimeoutMS </reference/connection-string/#mongodb-urioption-urioption.waitqueuetimeoutms>`
175
175
- {+int-data-type+}
176
- - | **MongoDB\Client**: N/A
176
+ - | **MongoDB\\ Client**: N/A
177
177
| **Connection URI**: ``waitQueueTimeoutMS=10000``
178
178
179
179
Write Concern Options
@@ -189,17 +189,17 @@ Write Concern Options
189
189
190
190
* - :manual:`w </reference/connection-string/#mongodb-urioption-urioption.w>`
191
191
- {+string-data-type+}
192
- - | **MongoDB\Client**: ``$uriOptions = [ 'w' => 'majority' ];``
192
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'w' => 'majority' ];``
193
193
| **Connection URI**: ``w=majority``
194
194
195
195
* - :manual:`wTimeoutMS </reference/connection-string/#mongodb-urioption-urioption.wtimeoutms>`
196
196
- {+int-data-type+}
197
- - | **MongoDB\Client**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];``
197
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];``
198
198
| **Connection URI**: ``wTimeoutMS=10000``
199
199
200
200
* - :manual:`journal </reference/connection-string/#mongodb-urioption-urioption.journal>`
201
201
- {+bool-data-type+}
202
- - | **MongoDB\Client**: ``$uriOptions = [ 'journal' => true ];``
202
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'journal' => true ];``
203
203
| **Connection URI**: ``journal=true``
204
204
205
205
Read Concern Options
@@ -215,7 +215,7 @@ Read Concern Options
215
215
216
216
* - :manual:`readConcernLevel </reference/connection-string/#mongodb-urioption-urioption.readconcernlevel>`
217
217
- {+string-data-type+}
218
- - | **MongoDB\Client**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];``
218
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];``
219
219
| **Connection URI**: ``readConcernLevel=majority``
220
220
221
221
Read Preference Options
@@ -230,26 +230,31 @@ Read Preference Options
230
230
- Syntax
231
231
232
232
* - :manual:`readPreference </reference/connection-string/#mongodb-urioption-urioption.readpreference>`
233
- - `MongoDB\\Driver\\ReadPreference <https://www.php.net/manual/en/class.mongodb-driver-readpreference.php>`__
234
- - **MongoDB\Client**:
235
-
236
- .. code-block::
237
-
238
- $uriOptions = [
239
- 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED
240
- ];
233
+ - ``int`` or ``string``
234
+ - **MongoDB\\Client**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];``
241
235
242
236
**Connection URI**: ``readPreference=secondaryPreferred``
237
+
238
+ For a complete list of the available values for this option, see the
239
+ `MongoDB\\Driver\\ReadPreference <https://www.php.net/manual/en/class.mongodb-driver-readpreference.php>`__
240
+ API documentation.
243
241
244
242
* - :manual:`maxStalenessSeconds </reference/connection-string/#mongodb-urioption-urioption.maxstalenessseconds>`
245
243
- {+int-data-type+}
246
- - | **MongoDB\Client**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];``
244
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];``
247
245
| **Connection URI**: ``maxStalenessSeconds=30``
248
246
249
247
* - :manual:`readPreferenceTags </reference/connection-string/#mongodb-urioption-urioption.readpreferencetags>`
250
248
- ``array``
251
- - | **MongoDB\Client**: ``$uriOptions = [ 'readPreferenceTags' => [[ 'region' => 'east' ], [ 'region' => 'west']];``
252
- | **Connection URI**: ``readPreferenceTags=region:east,region:west``
249
+ - **MongoDB\\Client**:
250
+
251
+ .. code-block::
252
+
253
+ $uriOptions = [
254
+ 'readPreferenceTags' => [[ 'region' => 'east' ], [ 'region' => 'west']]
255
+ ];
256
+
257
+ **Connection URI**: ``readPreferenceTags=region:east,region:west``
253
258
254
259
Authentication Options
255
260
~~~~~~~~~~~~~~~~~~~~~~
@@ -265,17 +270,17 @@ Authentication Options
265
270
266
271
* - :manual:`authMechanism </reference/connection-string/#mongodb-urioption-urioption.authmechanism>`
267
272
- {+string-data-type+}
268
- - | **MongoDB\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];``
273
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];``
269
274
| **Connection URI**: ``authMechanism=MONGODB-X509``
270
275
271
276
* - :manual:`authMechanismProperties </reference/connection-string/#mongodb-urioption-urioption.authmechanismproperties>`
272
277
- {+string-data-type+}
273
- - | **MongoDB\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];``
278
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];``
274
279
| **Connection URI**: ``authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:12345``
275
280
276
281
* - :manual:`authSource </reference/connection-string/#mongodb-urioption-urioption.authsource>`
277
282
- {+string-data-type+}
278
- - | **MongoDB\Client**: ``$uriOptions = [ 'authSource' => 'admin' ];``
283
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'authSource' => 'admin' ];``
279
284
| **Connection URI**: ``authSource=admin``
280
285
281
286
Server Selection and Discovery Options
@@ -292,27 +297,27 @@ Server Selection and Discovery Options
292
297
293
298
* - :manual:`localThresholdMS </reference/connection-string/#mongodb-urioption-urioption.localthresholdms>`
294
299
- {+int-data-type+}
295
- - | **MongoDB\Client**: ``$uriOptions = [ 'localThresholdMS' => 20 ];``
300
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'localThresholdMS' => 20 ];``
296
301
| **Connection URI**: ``localThresholdMS=20``
297
302
298
303
* - :manual:`serverSelectionTimeoutMS </reference/connection-string/#mongodb-urioption-urioption.serverselectiontimeoutms>`
299
304
- {+int-data-type+}
300
- - | **MongoDB\Client**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];``
305
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];``
301
306
| **Connection URI**: ``serverSelectionTimeoutMS=40000``
302
307
303
308
* - :manual:`serverSelectionTryOnce </reference/connection-string/#mongodb-urioption-urioption.serverselectiontryonce>`
304
309
- {+bool-data-type+}
305
- - | **MongoDB\Client**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];``
310
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];``
306
311
| **Connection URI**: ``serverSelectionTryOnce=false``
307
312
308
313
* - :manual:`heartbeatFrequencyMS </reference/connection-string/#mongodb-urioption-urioption.heartbeatfrequencyms>`
309
314
- {+int-data-type+}
310
- - | **MongoDB\Client**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];``
315
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];``
311
316
| **Connection URI**: ``heartbeatFrequencyMS=50000``
312
317
313
318
* - :manual:`socketCheckIntervalMS </reference/connection-string/#mongodb-urioption-urioption.socketcheckintervalms>`
314
319
- {+int-data-type+}
315
- - | **MongoDB\Client**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];``
320
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];``
316
321
| **Connection URI**: ``socketCheckIntervalMS=4000``
317
322
318
323
Miscellaneous Configuration
@@ -328,27 +333,27 @@ Miscellaneous Configuration
328
333
329
334
* - :manual:`appName </reference/connection-string/#mongodb-urioption-urioption.appname>`
330
335
- {+string-data-type+}
331
- - | **MongoDB\Client**: ``$uriOptions = [ 'appName' => 'myApp' ];``
336
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'appName' => 'myApp' ];``
332
337
| **Connection URI**: ``appName=myApp``
333
338
334
339
* - :manual:`retryReads </reference/connection-string/#mongodb-urioption-urioption.retryreads>`
335
340
- {+bool-data-type+}
336
- - | **MongoDB\Client**: ``$uriOptions = [ 'retryReads' => false ];``
341
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'retryReads' => false ];``
337
342
| **Connection URI**: ``retryReads=false``
338
343
339
344
* - :manual:`retryWrites </reference/connection-string/#mongodb-urioption-urioption.retrywrites>`
340
345
- {+bool-data-type+}
341
- - | **MongoDB\Client**: ``$uriOptions = [ 'retryWrites' => false ];``
346
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'retryWrites' => false ];``
342
347
| **Connection URI**: ``retryWrites=false``
343
348
344
349
* - :manual:`loadBalanced </reference/connection-string/#mongodb-urioption-urioption.loadbalanced>`
345
350
- {+bool-data-type+}
346
- - | **MongoDB\Client**: ``$uriOptions = [ 'loadBalanced' => true ];``
351
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'loadBalanced' => true ];``
347
352
| **Connection URI**: ``loadBalanced=false``
348
353
349
354
* - :manual:`srvMaxHosts </reference/connection-string/#mongodb-urioption-urioption.srvmaxhosts>`
350
355
- {+int-data-type+}
351
- - | **MongoDB\Client**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];``
356
+ - | **MongoDB\\ Client**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];``
352
357
| **Connection URI**: ``srvMaxHosts=5``
353
358
354
359
API Documentation
0 commit comments