@@ -97,12 +97,11 @@ Modify Find and Delete Behavior
9797~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9898
9999You can optionally modify the behavior of the ``find_one_and_delete()``
100- method by passing a ``FineOneAndDeleteOptions`` instance as a parameter.
101- To use default values for each setting, specify the value ``None`` for
102- the options parameter.
100+ method by chaining option builder methods to ``find_one_and_delete()``. These
101+ builder methods set ``FindOneAndDeleteOptions`` struct fields.
103102
104103The following table describes the options available in
105- ``FineOneAndDeleteOptions ``:
104+ ``FindOneAndDeleteOptions ``:
106105
107106.. list-table::
108107 :widths: 30 70
@@ -175,13 +174,15 @@ The following table describes the options available in
175174
176175.. TODO add links to guides for relevant options
177176
178- The {+driver-short+} implements the Builder design pattern for the
179- creation of a ``FindOneAndDeleteOptions`` instance. You can use the
180- type's ``builder()`` method to construct an options instance by
181- chaining option builder functions one at a time.
177+ .. note:: Setting Options
178+
179+ You can set ``FindOneAndDeleteOptions`` fields by chaining option builder methods directly
180+ to the ``find_one_and_delete()`` method call. If you're using an earlier version of the driver,
181+ you must construct a ``FindOneAndDeleteOptions`` instance by chaining option builder methods
182+ to the ``builder()`` method. Then, pass your options instance as a parameter to ``find_one_and_delete()``.
182183
183- The following code shows how to construct a ``FindOneAndDeleteOptions``
184- instance and pass it to the ``find_one_and_delete()`` method:
184+ The following code shows how to set the ``comment`` field by chaining
185+ the ``comment()`` method to the ``find_one_and_delete()`` method:
185186
186187.. literalinclude:: /includes/fundamentals/code-snippets/crud/compound.rs
187188 :start-after: begin-find-delete-options
@@ -236,12 +237,11 @@ Modify Find and Update Behavior
236237~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237238
238239You can optionally modify the behavior of the ``find_one_and_update()``
239- method by passing a ``FindOneAndUpdateOptions`` instance as a parameter.
240- To use default values for each setting, specify the value ``None`` for
241- the options parameter.
240+ method by chaining option builder methods to ``find_one_and_update()``. These
241+ builder methods set ``FindOneAndUpdateOptions`` struct fields.
242242
243243The following table describes the options available in
244- ``FineOneAndDeleteOptions ``:
244+ ``FindOneAndUpdateOptions ``:
245245
246246.. list-table::
247247 :widths: 30 70
@@ -343,13 +343,8 @@ The following table describes the options available in
343343.. TODO add link to array updates page under option
344344.. TODO add links to guides for relevant options
345345
346- The {+driver-short+} implements the Builder design pattern for the
347- creation of a ``FindOneAndUpdateOptions`` instance. You can use the
348- type's ``builder()`` method to construct an options instance by
349- chaining option builder methods one at a time.
350-
351- The following code shows how to construct a ``FindOneAndUpdateOptions``
352- instance and pass it to the ``find_one_and_update()`` method:
346+ The following code shows how to set the ``comment`` field by chaining
347+ the ``comment()`` method to the ``find_one_and_update()`` method:
353348
354349.. literalinclude:: /includes/fundamentals/code-snippets/crud/compound.rs
355350 :start-after: begin-find-update-options
@@ -361,15 +356,15 @@ instance and pass it to the ``find_one_and_update()`` method:
361356Find and Update Example
362357~~~~~~~~~~~~~~~~~~~~~~~
363358
364- This example shows how to call the ``find_one_and_update()`` method with the
365- following parameters:
359+ This example shows how to perform the following actions:
366360
367- - A query filter that matches a document where the value of ``school``
368- is ``"Aurora High School"``
369- - An update document that sets the ``school`` field to ``"Durango High School"``
370- and increments the ``age`` field by ``1``
371- - A ``FindOneAndUpdateOptions`` instance that returns the document
372- *after* the update
361+ - Call the ``find_one_and_update()`` method
362+ - Pass a query filter to ``find_one_and_update()`` that matches a document where the
363+ value of ``school`` is ``"Aurora High School"``
364+ - Pass an update document to ``find_one_and_update()`` that sets the ``school`` field to
365+ ``"Durango High School"`` and increments the ``age`` field by ``1``
366+ - Chain the ``return_document()`` method to ``find_one_and_update()`` to return
367+ the matched document *after* the update
373368
374369.. io-code-block::
375370 :copyable: true
@@ -411,9 +406,8 @@ Modify Find and Replace Behavior
411406~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
412407
413408You can optionally modify the behavior of the ``find_one_and_replace()``
414- method by passing a ``FindOneAndReplaceOptions`` instance as a parameter.
415- To use default values for each setting, specify the value ``None`` for
416- the options parameter.
409+ method by chaining option builder methods to ``find_one_and_replace()``. These
410+ builder methods set ``FindOneAndReplaceOptions`` struct fields.
417411
418412The following table describes the options available in
419413``FindOneAndReplaceOptions``:
@@ -511,14 +505,9 @@ The following table describes the options available in
511505
512506.. TODO add link to array updates page under option
513507.. TODO add links to guides for relevant options
514-
515- The {+driver-short+} implements the Builder design pattern for the
516- creation of a ``FindOneAndReplaceOptions`` instance. You can use the
517- type's ``builder()`` method to construct an options instance by
518- chaining option builder functions one at a time.
519508
520- The following code shows how to construct a ``FindOneAndReplaceOptions``
521- instance and pass it to the ``find_one_and_replace()`` method:
509+ The following code shows how to set the ``comment`` field by chaining
510+ the ``comment()`` method to the ``find_one_and_replace()`` method:
522511
523512.. literalinclude:: /includes/fundamentals/code-snippets/crud/compound.rs
524513 :start-after: begin-find-replace-options
@@ -530,15 +519,17 @@ instance and pass it to the ``find_one_and_replace()`` method:
530519Find and Replace Example
531520~~~~~~~~~~~~~~~~~~~~~~~~
532521
533- This example shows how to call the ``find_one_and_replace()`` method with the
534- following parameters:
535-
536- - A query filter that matches a document where the value of ``name``
537- includes the string ``"Johnson"``
538- - A replacement document that describes a new student
539- - A ``FindOneAndReplaceOptions`` instance that returns the document
540- after replacement and projects only the ``name`` and ``school`` fields
541- in the output
522+ This example performs the following actions:
523+
524+ - Calls the ``find_one_and_replace()`` method
525+ - Passes a query filter to ``find_one_and_replace()`` that matches a document
526+ where the value of ``name`` includes the string ``"Johnson"``
527+ - Passes a replacement document to ``find_one_and_replace()`` that describes a new
528+ student
529+ - Chains the ``return_document()`` method to ``find_one_and_replace()`` to return the document
530+ after replacement
531+ - Chains the ``projection()`` method to ``find_one_and_replace()``to project only the ``name``
532+ and ``school`` fields in the output
542533
543534.. io-code-block::
544535 :copyable: true
0 commit comments