@@ -50,14 +50,6 @@ Skip Documents
5050You can skip results retrieved by a query, or you can skip results within an
5151aggregation pipeline.
5252
53- This section describes how to skip results in the following ways:
54-
55- - :ref:`skip() method <rust-skip-method>`: Chain the ``skip()`` method to the
56- ``find()`` method
57- - :ref:`FindOptions struct <rust-findoptions-skip>`: Use the ``skip()`` option
58- builder method to configure a ``FindOptions`` struct
59- - :ref:`Aggregation pipleline <rust-aggregation-skip>`: Create a pipeline that uses the ``$skip`` stage
60-
6153If the number of skipped documents exceeds the number of matched documents for a
6254query, then that query returns no documents.
6355
@@ -66,14 +58,14 @@ fields. To avoid skipping random documents, use the ``sort()`` method to sort
6658documents on a field with a unique value before setting a skip option. To learn
6759more, see the :ref:`rust-sort-guide` guide.
6860
69- .. _rust-skip-method :
61+ .. _rust-skip-example :
7062
71- skip() Method Example
72- ~~~~~~~~~~~~~~~~~~~~~~
63+ Query Results Example
64+ ~~~~~~~~~~~~~~~~~~~~~
7365
74- To skip documents, you can chain the ``skip() `` method to the ``find()`` method.
75- The ``skip()`` method takes an integer that specifies the number of documents to
76- omit from the beginning of the result set.
66+ To skip documents, you can initialize a ``FindOptions `` instance and specify the
67+ number of documents you want to skip using the ``skip()`` option. Then, pass
68+ your ``FindOptions`` struct as a parameter to the ``find()`` method.
7769
7870This example runs a ``find()`` operation that performs the following actions:
7971
@@ -97,39 +89,6 @@ This example runs a ``find()`` operation that performs the following actions:
9789 Book { name: "A Dance with Dragons", author: "Martin", length: 1104 }
9890 Book { name: "Atlas Shrugged", author: "Rand", length: 1088 }
9991
100- .. _rust-findoptions-skip:
101-
102- Options Example
103- ~~~~~~~~~~~~~~~
104-
105- Alternatively, if you are setting and reusing options for your query, you can
106- use ``FindOptions``. Set the ``skip`` field of the ``FindOptions`` struct by
107- using the ``skip()`` option builder method. Then, chain the ``with_options()``
108- method to the ``find()`` method and pass your ``FindOptions`` struct as a
109- parameter to the ``with_options()`` method.
110-
111- This example runs a ``find()`` operation that performs the following actions:
112-
113- - Sorts the results in descending order of their ``name`` field values
114- - Skips the first document
115- - Returns the remaining documents
116-
117- .. io-code-block::
118- :copyable: true
119-
120- .. input:: /includes/fundamentals/code-snippets/crud/skip.rs
121- :start-after: start-options-skip-example
122- :end-before: end-options-skip-example
123- :language: rust
124- :dedent:
125-
126- .. output::
127- :language: console
128- :visible: false
129-
130- Book { name: "Les Misérables", author: "Hugo", length: 1462 }
131- Book { name: "Atlas Shrugged", author: "Rand", length: 1088 }
132-
13392.. _rust-aggregation-skip:
13493
13594Aggregation Example
@@ -171,6 +130,7 @@ To learn more about the operations mentioned in this guide, see the following gu
171130- :ref:`rust-compound-operations`
172131- :ref:`rust-aggregation`
173132- :ref:`rust-sort-guide`
133+
174134.. - :ref:`rust-limit-guide`
175135
176136API Documentation
0 commit comments