@@ -52,28 +52,29 @@ The ``writeConcern()`` and ``withWriteConcern()`` methods accept a
52
52
``WriteConcern`` instance as a parameter. You can specify the write concern by
53
53
using one of the following values:
54
54
55
- - ``WriteConcern.ACKNOWLEDGED``: The write operation returns after the primary
56
- node acknowledges the write operation .
55
+ - ``WriteConcern.ACKNOWLEDGED``: The write operation returns after the operation
56
+ is written to memory .
57
57
- ``WriteConcern.W1``: The write operation returns after only the primary node acknowledges
58
- the write operation.
58
+ the write operation, without waiting for acknowledgement from secondary nodes .
59
59
- ``WriteConcern.W2``: The write operation returns after the primary node and
60
60
at least one secondary node acknowledge the write operation.
61
61
- ``WriteConcern.W3``: The write operation returns after the primary node and
62
- at least two secondary nodes acknowledge the write operation.
62
+ at least two secondary nodes acknowledge the write operation.
63
63
- ``WriteConcern.MAJORITY``: The write operation returns after a majority of the
64
- replica set members acknowledge the write operation.
64
+ replica set members acknowledge the write operation.
65
65
- ``WriteConcern.UNACKNOWLEDGED``: The write operation returns after the primary
66
- node processes the write operation.
66
+ node processes the write operation.
67
67
- ``WriteConcern.JOURNALED``: The write operation returns after the primary node
68
- writes the data to the on-disk journal.
68
+ writes the data to the on-disk journal.
69
69
70
- The following example sets the write concern to ``"majority"`` for on a client
71
- instance :
70
+ The following example sets the write concern to ``"majority"`` for an instance of
71
+ ``MongoClient`` :
72
72
73
73
.. literalinclude:: /includes/read-write-configuration.java
74
74
:start-after: // start-write-concern-client
75
75
:end-before: // end-write-concern-client
76
76
:language: java
77
+ :emphasize-lines: 3
77
78
78
79
The following example sets the write concern to ``"majority"`` for a collection:
79
80
@@ -109,7 +110,7 @@ methods accept a single parameter that specifies the read concern level.
109
110
You can set the following read concern levels:
110
111
111
112
- ``ReadConcern.LOCAL``: The query returns the instance's most recent data. Provides no guarantee
112
- that the data has been written to a majority of the replica set members.
113
+ that the data has been written to a majority of the replica set members.
113
114
- ``ReadConern.AVAILABLE``: The query returns the instance's most recent data.
114
115
Provides no guarantee that the data has been written to a majority of the
115
116
replica set members. ``ReadConcern.AVAILABLE`` is not available for use with
@@ -120,7 +121,7 @@ You can set the following read concern levels:
120
121
successful writes that completed prior to the start of the read operation.
121
122
``ReadConcern.LINEARIZABLE`` is not available for use with causally consistent
122
123
sessions and transactions.
123
- - ``ReadConcern.SNAPSHOT``: The query returns majority-committed data as it appears across shards from a
124
+ - ``ReadConcern.SNAPSHOT``: The query returns majority-committed data as it appears across shards, from a
124
125
specific single point in the recent past.
125
126
126
127
For more information about the read concern levels, see :manual:`Read Concern
@@ -134,6 +135,7 @@ The following example sets the read concern to ``ReadConcern.MAJORITY`` for an i
134
135
:start-after: // start-read-concern-client
135
136
:end-before: // end-read-concern-client
136
137
:language: java
138
+ :emphasize-lines: 3
137
139
138
140
The following example sets the read concern to ``ReadConcern.MAJORITY`` for a
139
141
collection:
@@ -150,8 +152,7 @@ Read Preference
150
152
---------------
151
153
152
154
Read preference determines which member of a replica set MongoDB reads when
153
- running a query. You can also customize how the server evaluates a replica set
154
- member. You can set the read preference by using the ``readPreference()`` method
155
+ running a query. You can set the read preference by using the ``readPreference()`` method
155
156
on a client or transaction, or by using the ``withReadPreference()``
156
157
method on a database or collection.
157
158
@@ -175,6 +176,7 @@ for an instance of ``MongoClient``:
175
176
:start-after: // start-read-preference-client
176
177
:end-before: // end-read-preference-client
177
178
:language: java
179
+ :emphasize-lines: 3
178
180
179
181
The following example sets the read preference to ``ReadPreference.secondary()``
180
182
for a collection:
0 commit comments