Skip to content

Commit 5c8cd2a

Browse files
committed
AS PR fixes 1
1 parent 3e8a973 commit 5c8cd2a

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

source/write/replace.txt

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ removes all fields and values from a specified document except the
2727
operations differs from an update operation, which changes only
2828
specified fields in one or more documents.
2929

30-
.. tip:: Learn About Update Operations
31-
32-
To learn more about update operations, see the
33-
:ref:`kotlin-sync-write-update` guide.
30+
To learn more about update operations, see the
31+
:ref:`kotlin-sync-write-update` guide.
3432

3533
Sample Data
3634
~~~~~~~~~~~
@@ -85,9 +83,10 @@ value is ``"Primola Restaurant"``:
8583

8684
.. important::
8785

88-
The values of ``_id`` fields are immutable. If your replacement document specifies
89-
a value for the ``_id`` field, it must be the same as the ``_id`` value of the
90-
existing document.
86+
The values of ``_id`` fields are immutable. If your replacement
87+
document specifies a value for the ``_id`` field, it must be the same
88+
as the ``_id`` value of the existing document or the driver raises a
89+
``WriteError``.
9190

9291
Customize the Replace Operation
9392
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -141,13 +140,10 @@ configure an ``ReplaceOptions`` instance:
141140
* - ``comment()``
142141
- | Sets a comment to attach to the operation.
143142

144-
The following code uses the ``replaceOne()`` method to match the first
145-
document in which the value of the ``name`` field is ``"Pizza Plus"``,
146-
then replaces the fields with new fields.
147-
148-
Because the ``upsert`` option is set to ``true``, the driver inserts a
149-
new document that has the fields and values specified in the replacement
150-
document if the query filter doesn't match any existing documents.
143+
The following code sets the ``upsert`` option ``true``, instructing the
144+
driver to insert a new document that has the fields and values specified
145+
in the replacement document if the query filter doesn't match any
146+
existing documents:
151147

152148
.. literalinclude:: /includes/write/replace.kt
153149
:start-after: start-replace-options
@@ -171,19 +167,19 @@ an ``UpdateResult`` instance:
171167
- Description
172168

173169
* - ``getMatchedCount()``
174-
- | Indicates the number of documents that matched the query filter, regardless of
170+
- | Returns the number of documents that matched the query filter, regardless of
175171
how many updates were performed.
176172

177173
* - ``getModifiedCount()``
178-
- | Indicates number of documents modified by the update operation. If an updated
174+
- | Returns the number of documents modified by the update operation. If an updated
179175
document is identical to the original, it is not included in this
180176
count.
181177

182178
* - ``wasAcknowledged()``
183179
- | Returns ``true`` if the server acknowledged the result.
184180

185181
* - ``getUpsertedId()``
186-
- | Specifies the ``_id`` value of the document that was upserted
182+
- | Returns the ``_id`` value of the document that was upserted
187183
in the database, if the driver performed an upsert.
188184

189185
Additional Information

source/write/update.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,19 @@ an ``UpdateResult`` instance:
183183
- Description
184184

185185
* - ``getMatchedCount()``
186-
- | Indicates the number of documents that matched the query filter, regardless of
186+
- | Returns the number of documents that matched the query filter, regardless of
187187
how many updates were performed.
188188

189189
* - ``getModifiedCount()``
190-
- | Indicates number of documents modified by the update operation. If an updated
190+
- | Returns the number of documents modified by the update operation. If an updated
191191
document is identical to the original, it is not included in this
192192
count.
193193

194194
* - ``wasAcknowledged()``
195195
- | Returns ``true`` if the server acknowledged the result.
196196

197197
* - ``getUpsertedId()``
198-
- | Specifies the ``_id`` value of the document that was upserted
198+
- | Returns the ``_id`` value of the document that was upserted
199199
in the database, if the driver performed an upsert.
200200

201201
.. note::

0 commit comments

Comments
 (0)