@@ -31,6 +31,9 @@ This guide includes the following sections:
3131- :ref:`Delete Operations <rust-delete-operations>` describes how to use the
3232 driver to execute delete operations
3333
34+ - :ref:`Delete Examples <rust-delete-operations>` provides code examples
35+ for the delete operations
36+
3437- :ref:`Additional Information <rust-crud-del-addtl-info>`
3538 provides links to resources and API documentation for types
3639 and methods mentioned in this guide
@@ -152,8 +155,40 @@ which describes the number of documents deleted. If no documents match
152155the query filter you specified, the delete operation does
153156not remove any documents, and the value of ``deleted_count`` is ``0``.
154157
155- delete_many() Example
156- ~~~~~~~~~~~~~~~~~~~~~
158+ Delete Examples
159+ ---------------
160+
161+ This section provides code examples for the following delete operations:
162+
163+ - :ref:`delete_one() <rust-delete-one-ex>`
164+ - :ref:`delete_many() <rust-delete-many-ex>`
165+
166+ .. _rust-delete-one-ex:
167+
168+ Delete One Example
169+ ~~~~~~~~~~~~~~~~~~
170+
171+ The following example uses the ``delete_one()`` method to delete a document
172+ that has an ``item`` value of ``"placemat"``:
173+
174+ .. io-code-block::
175+
176+ .. input:: /includes/fundamentals/code-snippets/crud/delete.rs
177+ :start-after: begin-delete-one
178+ :end-before: end-delete-one
179+ :language: rust
180+ :dedent:
181+
182+ .. output::
183+ :language: console
184+ :visible: false
185+
186+ Deleted documents: 1
187+
188+ .. _rust-delete-many-ex:
189+
190+ Delete Many Example
191+ ~~~~~~~~~~~~~~~~~~~
157192
158193This example performs the following actions:
159194
@@ -163,12 +198,11 @@ This example performs the following actions:
163198- Chains the ``hint()`` method to ``delete_many()`` to use the ``_id_`` index as the hint
164199 for the delete operation
165200
166-
167201.. io-code-block::
168202
169203 .. input:: /includes/fundamentals/code-snippets/crud/delete.rs
170- :start-after: begin-delete
171- :end-before: end-delete
204+ :start-after: begin-delete-many
205+ :end-before: end-delete-many
172206 :language: rust
173207 :dedent:
174208
0 commit comments