Skip to content

Commit 98ec3ad

Browse files
committed
NR feedback
1 parent f13be46 commit 98ec3ad

File tree

2 files changed

+14
-16
lines changed
  • source
    • fundamentals/crud/read-operations
    • includes/fundamentals/code-snippets/crud

2 files changed

+14
-16
lines changed

source/fundamentals/crud/read-operations/skip.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ collection:
4747
Skip Documents
4848
--------------
4949

50-
This section describes how to skip results retrieved by a query in the following ways:
50+
You can skip results retrieved by a query, or you can skip results within an
51+
aggregation pipeline.
52+
53+
This section describes how to skip results in the following ways:
5154

5255
- :ref:`skip() method <rust-skip-method>`: Chain the ``skip()`` method to the
5356
``find()`` method
54-
- :ref:`FindOptions::skip() method <rust-findoptions-skip>`: Use the ``skip()``
55-
method of the ``FindOptions`` struct
56-
57-
Alternatively, you can :ref:`skip documents in an aggregation pipeline
58-
<rust-aggregation-skip>`.
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
5960

6061
If the number of skipped documents exceeds the number of matched documents for a
6162
query, then that query returns no documents.
@@ -70,9 +71,9 @@ more, see the :ref:`rust-sort-guide` guide.
7071
skip() Method Example
7172
~~~~~~~~~~~~~~~~~~~~~~
7273

74+
To skip documents, you can chain the ``skip()`` method to the ``find()`` method.
7375
The ``skip()`` method takes an integer that specifies the number of documents to
74-
omit from the beginning of the result set. Chain the ``skip()`` method
75-
to the ``find()`` method to skip documents.
76+
omit from the beginning of the result set.
7677

7778
This example runs a ``find()`` operation that performs the following actions:
7879

@@ -103,15 +104,14 @@ Options Example
103104

104105
Alternatively, if you are setting and reusing options for your query, you can
105106
use ``FindOptions``. Set the ``skip`` field of the ``FindOptions`` struct by
106-
using the ``skip()`` setter method. Then, chain the ``with_options()`` method to
107-
the ``find()`` method and pass your ``FindOptions`` struct as a parameter to the
108-
``with_options()`` method.
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.
109110

110111
This example runs a ``find()`` operation that performs the following actions:
111112

112113
- Sorts the results in descending order of their ``name`` field values
113114
- Skips the first document
114-
- Limits the results to two documents
115115
- Returns the remaining documents
116116

117117
.. io-code-block::
@@ -136,7 +136,7 @@ Aggregation Example
136136
~~~~~~~~~~~~~~~~~~~
137137

138138
You can use the ``$skip`` stage in an aggregation pipeline to skip documents. To
139-
learn more, see the :ref:`rust-aggregation` guide.
139+
learn more about aggregation operations, see the :ref:`rust-aggregation` guide.
140140

141141
This example runs an aggregation pipeline that performs the following actions:
142142

source/includes/fundamentals/code-snippets/crud/skip.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,11 @@ async fn main() -> mongodb::error::Result<()> {
6363
// end-skip-example
6464

6565
// Sets the values for the `FindOptions` struct to sort results by their "name"
66-
// field values, skip the first two results, and limit the results to two
67-
// documents.
66+
// field values, skip the first two results, and return the remaining results.
6867
// start-options-skip-example
6968
let find_options = FindOptions::builder()
7069
.sort(doc! { "name": -1 })
7170
.skip(1)
72-
.limit(2)
7371
.build();
7472

7573
let mut cursor = my_coll.find(doc! {}).with_options(find_options).await?;

0 commit comments

Comments
 (0)