You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/connection/specify-connection-options/cluster-settings.txt
+32-41Lines changed: 32 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,11 @@ String` or :guilabel:`MongoClientSettings` tab to see the options available:
33
33
.. tab:: Connection String
34
34
:tabid: uri
35
35
36
-
.. list-table::
37
-
:header-rows: 1
38
-
:widths: 40 40 20
36
+
Include the following parameters in your connection string to modify the driver's behavior when interacting with your MongoDB cluster:
37
+
38
+
.. list-table::
39
+
:header-rows: 1
40
+
:widths: 20,20,60
39
41
40
42
* - Option Name
41
43
- Type
@@ -52,33 +54,24 @@ String` or :guilabel:`MongoClientSettings` tab to see the options available:
52
54
* - **localThresholdMS**
53
55
- integer
54
56
- When communicating with multiple instances of MongoDB in a replica
55
-
set, the driver will only send requests to a server whose response
56
-
time is less than or equal to the server with the fastest response
57
-
time plus the local threshold, in milliseconds.
57
+
set, the driver will only send requests to a server whose response
58
+
time is less than or equal to the server with the fastest response
59
+
time plus the local threshold, in milliseconds.
58
60
59
61
**Default**: ``15``
60
-
61
-
* - **heartbeatFrequencyMS**
62
-
- integer
63
-
- Specifies the frequency, in milliseconds that the driver will wait
64
-
between attempts to determine the current state of each server in
65
-
the cluster.
66
-
67
-
**Default**: ``10000`` (10 seconds)
68
-
69
62
* - **replicaSet**
70
63
- string
71
64
- Specifies that the :ref:`connection string <connection-uri>`
72
-
provided includes multiple hosts. When specified, the driver
73
-
attempts to find all members of that set.
65
+
provided includes multiple hosts. When specified, the driver
66
+
attempts to find all members of that set.
74
67
75
68
**Default**: ``null``
76
69
77
70
* - **directConnection**
78
71
- boolean
79
72
- Specifies that the driver must connect to the host directly. This
80
-
maps to applying ``mode(ClusterConnectionMode.SINGLE)`` to your
81
-
``MongoClientSettings``.
73
+
maps to applying ``mode(ClusterConnectionMode.SINGLE)`` to your
74
+
``MongoClientSettings``.
82
75
83
76
**Default**: ``false``
84
77
@@ -128,8 +121,8 @@ String` or :guilabel:`MongoClientSettings` tab to see the options available:
128
121
* - ``localThreshold()``
129
122
- Sets the amount of time that a server’s round trip can take and
130
123
still be eligible for server selection.
131
-
|
132
-
| **Default**: ``15 milliseconds``
124
+
125
+
**Default**: ``15 milliseconds``
133
126
134
127
* - ``mode()``
135
128
- Sets how to connect to a MongoDB deployment.
@@ -142,22 +135,19 @@ String` or :guilabel:`MongoClientSettings` tab to see the options available:
142
135
143
136
* - ``serverSelectionTimeout()``
144
137
- Sets the maximum time to select a primary node before throwing a
145
-
timeout exception.
146
-
|
147
-
| **Default**: ``30 seconds``
138
+
timeout exception.
139
+
140
+
**Default**: ``30 seconds``
148
141
149
142
* - ``serverSelector()``
150
143
- Adds a server selector to apply before server selection.
151
144
152
145
* - ``srvHost()``
153
-
- Sets the host name to use to look up an SRV DNS record to find the
154
-
MongoDB hosts.
155
-
|
156
-
| If you want to enable the processing of TXT records associated
157
-
with the host, specify the SRV host in the connection string using
158
-
the ``applyConnectionString()`` method.
159
-
|
160
-
| For example:
146
+
- Sets the host name to use to look up an SRV DNS record to find the MongoDB hosts.
147
+
148
+
If you want to enable the processing of TXT records associated with the host, specify the SRV host in the connection string using the ``applyConnectionString()`` method.
149
+
150
+
For example:
161
151
162
152
.. code-block:: java
163
153
:emphasize-lines: 3
@@ -170,11 +160,8 @@ String` or :guilabel:`MongoClientSettings` tab to see the options available:
170
160
- Sets the maximum number of hosts the driver can connect to when
171
161
using the DNS seedlist (SRV) connection protocol, identified by
172
162
the ``mongodb+srv`` connection string prefix.
173
-
|
174
-
| Throws an exception if you are not using the SRV connection protocol.
175
-
176
-
Example
177
-
~~~~~~~
163
+
164
+
Throws an exception if you are not using the SRV connection protocol.
178
165
179
166
This example specifies for the driver to connect directly to a server,
180
167
regardless of the type of MongoDB cluster it's a part of:
@@ -186,8 +173,12 @@ String` or :guilabel:`MongoClientSettings` tab to see the options available:
186
173
:emphasize-lines: 3-4
187
174
:dedent:
188
175
189
-
.. tip::
176
+
.. tip::
177
+
178
+
This is analogous to the ``directConnection`` parameter you can specify
179
+
in your connection URI. See :ref:`<connection-options>` for more
180
+
information.
190
181
191
-
This is analogous to the ``directConnection`` parameter you can specify
192
-
in your connection URI. See :ref:`<connection-options>` for more
193
-
information.
182
+
For more information, see the `MongoClientSettings.Builder
Include the following parameters in your connection string to modify the
43
+
driver's read/write behavior:
44
+
47
45
.. list-table::
48
46
:header-rows: 1
49
-
:widths: 25,25,50
47
+
:widths: 20,20,60
50
48
51
49
* - Option Name
52
50
- Type
53
51
- Description
54
52
55
53
* - **journal**
56
54
- boolean
57
-
- | Specifies that the driver must wait for the connected MongoDB
58
-
instance to group commit to the journal file on disk for all
59
-
writes.
60
-
|
61
-
| **Default**: ``false``
55
+
- Specifies that the driver must wait for the connected MongoDB instance to group commit to the journal file on disk for all writes.
56
+
57
+
**Default**: ``false``
62
58
63
59
* - **w**
64
60
- string or integer
65
-
- | Specifies the write concern. For more information about values, see the server documentation for the :manual:`w option </reference/write-concern/#w-option>`.
66
-
|
67
-
| **Default**: ``1``
61
+
- Specifies the write concern. For more information about values, see
62
+
the server documentation for the :manual:`w option
63
+
</reference/write-concern/#w-option>`.
64
+
65
+
**Default**: ``1``
68
66
69
67
* - **wtimeoutMS**
70
68
- integer
71
-
- | Specifies a time limit, in milliseconds, for the write concern. For
72
-
more information, see the server documentation for the
73
-
:manual:`wtimeoutMS option
74
-
</reference/connection-string/#write-concern-options>`. A value of
75
-
``0`` instructs the driver to never time out write operations.
76
-
|
77
-
| **Default**: ``0``
69
+
- Specifies a time limit, in milliseconds, for the write concern. For
70
+
more information, see the server documentation for the
71
+
:manual:`wtimeoutMS option
72
+
</reference/connection-string/#write-concern-options>`. A value of
73
+
``0`` instructs the driver to never time out write operations.
74
+
75
+
**Default**: ``0``
78
76
79
77
* - **readPreference**
80
78
- string
81
-
- | Specifies the read preference. For more information about values,
82
-
see the server documentation for the :manual:`readPreference option
- Whether the driver performs :manual:`retry reads
164
+
</core/retryable-reads/>` if a network error occurs.
165
+
166
+
**Default**: ``true``
160
167
161
168
* - ``retryWrites()``
162
-
- | Whether the driver performs :manual:`retry writes
163
-
</core/retryable-writes/>` if a network error occurs.
164
-
|
165
-
| **Default**: ``true``
169
+
- Whether the driver performs :manual:`retry writes
170
+
</core/retryable-writes/>` if a network error occurs.
171
+
172
+
**Default**: ``true``
166
173
167
174
* - ``uuidRepresentation()``
168
175
- Sets the UUID representation to use when encoding instances of UUID
169
176
and decoding BSON binary values with subtype of 3.
170
177
171
178
* - ``writeConcern()``
172
-
- | Sets the :manual:`write concern </reference/write-concern/>`.
173
-
|
174
-
| **Default**: ``WriteConcern#ACKNOWLEDGED``.
179
+
- Sets the :manual:`write concern </reference/write-concern/>`.
180
+
181
+
**Default**: ``WriteConcern#ACKNOWLEDGED``.
175
182
| For more information about the default value, see :manual:`Implicit Default Write Concern </reference/write-concern/#implicit-default-write-concern>`.
0 commit comments