@@ -77,7 +77,7 @@ instance to the constructor. The code configures the following settings:
77
77
- ``W2`` write concern: The primary replica set member and one secondary member
78
78
must acknowledge the write operation.
79
79
80
- .. literalinclude:: /includes/connect /ReplicaSets.java
80
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
81
81
:language: java
82
82
:dedent:
83
83
:start-after: start-client-settings
@@ -86,7 +86,7 @@ instance to the constructor. The code configures the following settings:
86
86
Alternatively, you can specify the read and write settings in the connection
87
87
URI, which is passed as a parameter to the ``MongoClient`` constructor:
88
88
89
- .. literalinclude:: /includes/connect /ReplicaSets.java
89
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
90
90
:language: java
91
91
:dedent:
92
92
:start-after: start-client-settings-uri
@@ -118,7 +118,7 @@ The example configures the following settings:
118
118
- ``W1`` write concern: The primary replica set member must acknowledge the
119
119
write operation.
120
120
121
- .. literalinclude:: /includes/connect /ReplicaSets.java
121
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
122
122
:language: java
123
123
:dedent:
124
124
:start-after: start-transaction-settings
@@ -142,7 +142,7 @@ settings:
142
142
- ``MAJORITY`` write concern: The majority of all replica set members
143
143
must acknowledge the write operation.
144
144
145
- .. literalinclude:: /includes/connect /ReplicaSets.java
145
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
146
146
:language: java
147
147
:dedent:
148
148
:start-after: start-database-settings
@@ -167,7 +167,7 @@ settings:
167
167
- ``UNACKNOWLEDGED`` write concern: Replica set members do not need to acknowledge
168
168
the write operation.
169
169
170
- .. literalinclude:: /includes/connect /ReplicaSets.java
170
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
171
171
:language: java
172
172
:dedent:
173
173
:start-after: start-collection-settings
@@ -208,7 +208,7 @@ preference. The read preference is re-evaluated for each operation.
208
208
The following example shows how to connect to a sharded cluster and specify a
209
209
``secondary`` read preference in your connection string:
210
210
211
- .. literalinclude:: /includes/connect /ReplicaSets.java
211
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
212
212
:language: java
213
213
:dedent:
214
214
:start-after: start-sharded-cluster-uri
@@ -260,7 +260,7 @@ set members to the ``ReadPreference.secondary()`` setter method. Then, the code
260
260
passes the read preference information to the ``withReadPreference()`` method
261
261
to set the read order on the database:
262
262
263
- .. literalinclude:: /includes/connect /ReplicaSets.java
263
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
264
264
:language: java
265
265
:dedent:
266
266
:start-after: start-tag-set
@@ -289,7 +289,7 @@ corresponding code for each approach:
289
289
.. tab:: MongoClientSettings
290
290
:tabid: settings
291
291
292
- .. literalinclude:: /includes/connect /ReplicaSets.java
292
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
293
293
:language: rust
294
294
:dedent:
295
295
:start-after: start-local-threshold-settings
@@ -299,7 +299,7 @@ corresponding code for each approach:
299
299
.. tab:: Connection URI
300
300
:tabid: uri
301
301
302
- .. literalinclude:: /includes/connect /ReplicaSets.java
302
+ .. literalinclude:: /includes/fundamentals/code-snippets /ReplicaSets.java
303
303
:language: rust
304
304
:dedent:
305
305
:start-after: start-local-threshold-uri
0 commit comments