Skip to content

Commit 9842c6d

Browse files
committed
DOCS-671 min-max edits
1 parent 089f8df commit 9842c6d

File tree

3 files changed

+56
-63
lines changed

3 files changed

+56
-63
lines changed

source/faq/indexes.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ criterion is part of the query.
122122
Can I use index keys to constrain query matches?
123123
------------------------------------------------
124124

125-
The :method:`min() <cursor.min()>` and the :method:`max()
126-
<cursor.max()>` methods provide a way to constrain the results of the
127-
:method:`find() <db.collection.find()>` method using index keys.
128-
129-
125+
You can use the :method:`min() <cursor.min()>` and the :method:`max()
126+
<cursor.max()>` methods to constrain the results of the cursor returned
127+
from :method:`find() <db.collection.find()>` by using the index keys.

source/reference/method/cursor.max.txt

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ cursor.max()
88

99
The :method:`max() <cursor.max()>` method specifies the *exclusive*
1010
upper bound for a specific index in order to constrain the results
11-
of the :method:`find() <db.collection.find()>` method. The
12-
:method:`max() <cursor.max()>` method provides a way to specify an
13-
upper bound on compound key indexes.
11+
of :method:`find() <db.collection.find()>`. :method:`max()
12+
<cursor.max()>` provides a way to specify an upper bound on compound
13+
key indexes.
1414

15-
The :method:`max() <cursor.max()>` method takes the following parameter:
15+
:method:`max() <cursor.max()>` takes the following parameter:
1616

1717
:param document indexbounds:
1818

@@ -31,8 +31,7 @@ cursor.max()
3131
fields with different sort orders, the selection of the index
3232
may be ambiguous.
3333

34-
Consider the following example of the :method:`max() <cursor.max()>`
35-
method:
34+
Consider the following examples of :method:`max() <cursor.max()>`:
3635

3736
The examples assume a collection ``products`` with the following documents:
3837

@@ -58,10 +57,10 @@ cursor.max()
5857
{ "item" : 1, "type" : -1 }
5958
{ "price" : 1 }
6059

61-
- Using the ordering of ``{ item: 1, type: 1 }`` index, the :method:`max()
62-
<cursor.max()>` method limits the query to the documents that are
63-
below the bound of ``item`` equal to ``apple`` and ``type`` equal
64-
to ``jonagold``:
60+
- Using the ordering of ``{ item: 1, type: 1 }`` index,
61+
:method:`max() <cursor.max()>` limits the query to the documents
62+
that are below the bound of ``item`` equal to ``apple`` and
63+
``type`` equal to ``jonagold``:
6564

6665
.. code-block:: javascript
6766

@@ -80,12 +79,12 @@ cursor.max()
8079
whether :program:`mongod` would select the ``{ item: 1, type: 1
8180
}`` index ordering or the ``{ item: 1, type: -1 }`` index ordering.
8281

83-
- Using the ordering of the index ``{ price: 1 }``, the :method:`max()
84-
<cursor.max()>` method limits the query to the documents that are
85-
below the index key bound of ``price`` equal to ``1.99`` and the
86-
:method:`min() <cursor.min()>` method limits the query to the
87-
documents that are at or above the index key bound of ``price``
88-
equal to ``1.39``:
82+
- Using the ordering of the index ``{ price: 1 }``, :method:`max()
83+
<cursor.max()>` limits the query to the documents that are below
84+
the index key bound of ``price`` equal to ``1.99`` and
85+
:method:`min() <cursor.min()>` limits the query to the documents
86+
that are at or above the index key bound of ``price`` equal to
87+
``1.39``:
8988

9089
.. code-block:: javascript
9190

@@ -103,10 +102,10 @@ cursor.max()
103102

104103
.. note::
105104

106-
- Because the :method:`max() <cursor.max()>` method requires a
107-
corresponding index as well as enforces the use of that index,
108-
it may be preferable to use the :operator:`$lt` operator in the
109-
query if possible. Consider the following example:
105+
- Because :method:`max() <cursor.max()>` requires a corresponding
106+
index as well as enforces the use of that index, it may be
107+
preferable to use the :operator:`$lt` operator in the query if
108+
possible. Consider the following example:
110109

111110
.. code-block:: javascript
112111

@@ -115,15 +114,14 @@ cursor.max()
115114
The query will use the index on the ``price`` field, even if
116115
the index on ``_id`` may be better.
117116

118-
- The :method:`max() <cursor.max()>` method exists primarily to
119-
support the :program:`mongos` (sharding) process.
117+
- :method:`max() <cursor.max()>` exists primarily to support the
118+
:program:`mongos` (sharding) process.
120119

121-
- If you use :method:`max() <cursor.max()>` method with the
122-
:method:`min() <cursor.min()>` method to specify a range, the
123-
index bounds specified in :method:`min() <cursor.min()>` method
124-
and the :method:`max() <cursor.max()>` method must both refer
125-
to the keys of the same index.
120+
- If you use :method:`max() <cursor.max()>` with :method:`min()
121+
<cursor.min()>` to specify a range, the index bounds specified
122+
in :method:`min() <cursor.min()>` and :method:`max()
123+
<cursor.max()>` must both refer to the keys of the same index.
126124

127-
- The :method:`max() <cursor.max()>` method is a shell wrapper
128-
around the special operator :operator:`$max`.
125+
- :method:`max() <cursor.max()>` is a shell wrapper around the
126+
special operator :operator:`$max`.
129127

source/reference/method/cursor.min.txt

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ cursor.min()
88

99
The :method:`min() <cursor.min()>` method specifies the *inclusive*
1010
lower bound for a specific index in order to constrain the results
11-
of the :method:`find() <db.collection.find()>` method. The
12-
:method:`min() <cursor.min()>` method provides a way to specify
13-
lower bounds on compound key indexes.
11+
of :method:`find() <db.collection.find()>`. :method:`min()
12+
<cursor.min()>` provides a way to specify lower bounds on compound
13+
key indexes.
1414

15-
The :method:`min() <cursor.min()>` method takes the following parameter:
15+
:method:`min() <cursor.min()>` takes the following parameter:
1616

1717
:param document indexbounds:
1818

@@ -31,8 +31,7 @@ cursor.min()
3131
fields with different sort orders, the selection of the index
3232
may be ambiguous.
3333

34-
Consider the following examples of the :method:`min() <cursor.min()>`
35-
method:
34+
Consider the following examples of :method:`min() <cursor.min()>`:
3635

3736
The examples assume a collection ``products`` with the following documents:
3837

@@ -58,10 +57,10 @@ cursor.min()
5857
{ "item" : 1, "type" : -1 }
5958
{ "price" : 1 }
6059

61-
- Using the ordering of ``{ item: 1, type: 1 }`` index, the
62-
:method:`min() <cursor.min()>` method limits the query to the
63-
documents that are at or above the index key bound of ``item``
64-
equal to ``apple`` and ``type`` equal to ``jonagold``:
60+
- Using the ordering of ``{ item: 1, type: 1 }`` index,
61+
:method:`min() <cursor.min()>` limits the query to the documents
62+
that are at or above the index key bound of ``item`` equal to
63+
``apple`` and ``type`` equal to ``jonagold``:
6564

6665
.. code-block:: javascript
6766

@@ -85,12 +84,11 @@ cursor.min()
8584
whether :program:`mongod` would select the ``{ item: 1, type: 1
8685
}`` index ordering or the ``{ item: 1, type: -1 }`` index ordering.
8786

88-
- Using the ordering of the index ``{ price: 1 }``, the :method:`min()
89-
<cursor.min()>` method limits the query to the documents that are
90-
at or above the index key bound of ``price`` equal to ``1.39`` and
91-
the :method:`max() <cursor.max()>` method limits the query to the
92-
documents that are below the index key bound of ``price`` equal to
93-
``1.99``:
87+
- Using the ordering of the index ``{ price: 1 }``, :method:`min()
88+
<cursor.min()>` limits the query to the documents that are at or
89+
above the index key bound of ``price`` equal to ``1.39`` and
90+
:method:`max() <cursor.max()>` limits the query to the documents
91+
that are below the index key bound of ``price`` equal to ``1.99``:
9492

9593
.. code-block:: javascript
9694

@@ -108,10 +106,10 @@ cursor.min()
108106

109107
.. note::
110108

111-
- Because the :method:`min() <cursor.min()>` method requires a
112-
corresponding index as well as enforces the use of that index,
113-
it may be preferable to use the :operator:`$gte` operator in
114-
the query if possible. Consider the following example:
109+
- Because :method:`min() <cursor.min()>` requires a corresponding
110+
index as well as enforces the use of that index, it may be
111+
preferable to use the :operator:`$gte` operator in the query if
112+
possible. Consider the following example:
115113

116114
.. code-block:: javascript
117115

@@ -120,14 +118,13 @@ cursor.min()
120118
The query will use the index on the ``price`` field, even if
121119
the index on ``_id`` may be better.
122120

123-
- The :method:`min() <cursor.min()>` method exists primarily to
124-
support the :program:`mongos` (sharding) process.
121+
- :method:`min() <cursor.min()>` exists primarily to support the
122+
:program:`mongos` (sharding) process.
125123

126-
- If you use :method:`min() <cursor.min()>` method with the
127-
:method:`max() <cursor.max()>` method to specify a range, the
128-
index bounds specified in :method:`min() <cursor.min()>` method
129-
and the :method:`max() <cursor.max()>` method must both refer
130-
to the keys of the same index.
124+
- If you use :method:`min() <cursor.min()>` with :method:`max()
125+
<cursor.max()>` to specify a range, the index bounds specified
126+
in :method:`min() <cursor.min()>` and :method:`max()
127+
<cursor.max()>` must both refer to the keys of the same index.
131128

132-
- The :method:`min() <cursor.min()>` method is a shell wrapper
133-
around the special operator :operator:`$min`.
129+
- :method:`min() <cursor.min()>` is a shell wrapper around the
130+
special operator :operator:`$min`.

0 commit comments

Comments
 (0)