@@ -8,11 +8,11 @@ cursor.min()
8
8
9
9
The :method:`min() <cursor.min()>` method specifies the *inclusive*
10
10
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.
14
14
15
- The :method:`min() <cursor.min()>` method takes the following parameter:
15
+ :method:`min() <cursor.min()>` takes the following parameter:
16
16
17
17
:param document indexbounds:
18
18
@@ -31,8 +31,7 @@ cursor.min()
31
31
fields with different sort orders, the selection of the index
32
32
may be ambiguous.
33
33
34
- Consider the following examples of the :method:`min() <cursor.min()>`
35
- method:
34
+ Consider the following examples of :method:`min() <cursor.min()>`:
36
35
37
36
The examples assume a collection ``products`` with the following documents:
38
37
@@ -58,10 +57,10 @@ cursor.min()
58
57
{ "item" : 1, "type" : -1 }
59
58
{ "price" : 1 }
60
59
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``:
65
64
66
65
.. code-block:: javascript
67
66
@@ -85,12 +84,11 @@ cursor.min()
85
84
whether :program:`mongod` would select the ``{ item: 1, type: 1
86
85
}`` index ordering or the ``{ item: 1, type: -1 }`` index ordering.
87
86
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``:
94
92
95
93
.. code-block:: javascript
96
94
@@ -108,10 +106,10 @@ cursor.min()
108
106
109
107
.. note::
110
108
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:
115
113
116
114
.. code-block:: javascript
117
115
@@ -120,14 +118,13 @@ cursor.min()
120
118
The query will use the index on the ``price`` field, even if
121
119
the index on ``_id`` may be better.
122
120
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.
125
123
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.
131
128
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