File tree Expand file tree Collapse file tree 7 files changed +20
-21
lines changed Expand file tree Collapse file tree 7 files changed +20
-21
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ In the :program:`mongo` shell, the :method:`find()
34
34
<db.collection.find()>` and :method:`findOne()
35
35
<db.collection.findOne()>` methods perform read operations. The
36
36
:method:`find() <db.collection.find()>` method has the following
37
- syntax [#formal-query-structure]_:
37
+ syntax: [#formal-query-structure]_
38
38
39
39
.. code-block:: javascript
40
40
Original file line number Diff line number Diff line change @@ -11,10 +11,10 @@ Introduction
11
11
12
12
In addition to the :doc:`MongoDB Query Operators
13
13
</reference/operators>`, there are a number of "meta" operators that
14
- you may use to modify the output or behavior of a query. On the server,
14
+ you can modify the output or behavior of a query. On the server,
15
15
MongoDB treats the query and the options as a single object. The
16
- :program:`mongo` shell may provide :ref:`cursor methods
17
- <js-query-cursor-methods>` for these options. When possible, use these
16
+ :program:`mongo` shell and driver interfaces may provide :ref:`cursor methods
17
+ <js-query-cursor-methods>` that wrap these options. When possible, use these
18
18
methods; otherwise, you can add these options using either of the
19
19
following syntax:
20
20
@@ -44,7 +44,7 @@ user-friendly interface and are the preferred way to add these options.
44
44
45
45
.. include:: operator/max.txt
46
46
:start-after: mongodb
47
-
47
+
48
48
.. include:: operator/min.txt
49
49
:start-after: mongodb
50
50
Original file line number Diff line number Diff line change @@ -14,5 +14,5 @@ $comment
14
14
15
15
.. code-block:: javascript
16
16
17
- db.collection.find( { <query> } )._addSpecial( "$comment", <comment to add > )
18
- db.collection.find( { $query: { <query> }, $comment: <comment to add > } )
17
+ db.collection.find( { <query> } )._addSpecial( "$comment", <comment> )
18
+ db.collection.find( { $query: { <query> }, $comment: <comment> } )
Original file line number Diff line number Diff line change 32
32
33
33
db.collection.find( { <query> } ).max( { age: 100 } )
34
34
35
- This operation above limits the query to those documents where the
35
+ This operation limits the query to those documents where the
36
36
field ``age`` is less than ``100`` using the index ``{ age: 1 }``.
37
-
37
+
38
38
You can explicitly specify the corresponding index with
39
39
:method:`cursor.hint()`. Otherwise, MongoDB selects the index using
40
40
the fields in the ``indexbounds``; however, if multiple indexes
49
49
{ age: 1, type: -1 }
50
50
{ age: 1, type: 1 }
51
51
52
- Without explicitly using :method:`cursor.hint()`, it is unclear
53
- which index the following operation will select :
52
+ Without explicitly using :method:`cursor.hint()`, MongoDB may
53
+ select either index for the following operation:
54
54
55
55
.. code-block:: javascript
56
56
57
57
db.collection.find().max( { age: 50, type: 'B' } )
58
58
59
- Use operation alone or in conjunction with :operator:`$min` to limit
59
+ Use :operator:`$max` alone or in conjunction with :operator:`$min` to limit
60
60
results to a specific range for the *same* index, as in the
61
61
following example:
62
62
75
75
76
76
db.collection.find( { _id: 7 } ).max( { age: 25 } )
77
77
78
- The query will use the index on the ``age`` field, even if the
78
+ The query uses the index on the ``age`` field, even if the
79
79
index on ``_id`` may be better.
Original file line number Diff line number Diff line change 23
23
db.collection.find( { $query: { <query> }, $min: { field1: <min value1>, ... fieldN: <min valueN> } } )
24
24
25
25
The :operator:`$min` specifies the lower bound for *all* keys of a
26
- specific index *in order*.
27
-
26
+ specific index *in order*.
27
+
28
28
Consider the following operations on a collection named
29
29
``collection`` that has an index ``{ age: 1 }``:
30
30
59
59
You can use :operator:`$min` in conjunction with :operator:`$max` to
60
60
limit results to a specific range for the *same* index, as in the
61
61
following example:
62
-
62
+
63
63
.. code-block:: javascript
64
64
65
65
db.collection.find().min( { age: 20 } ).max( { age: 25 } )
Original file line number Diff line number Diff line change 19
19
.. code-block:: javascript
20
20
21
21
db.collection.find( { age : 25 } )
22
-
22
+
23
23
These operations return only those documents in the collection named
24
24
``collection`` where the ``age`` field equals ``25``.
Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ $snapshot
39
39
:operator:`$orderby` (or the corresponding
40
40
:method:`cursor.hint()` and :method:`cursor.sort()` methods.)
41
41
42
- .. [#snapshot-alternative]
43
-
44
- You can achieve the :operator:`$snapshot` isolation behavior
45
- using any *unique* index on invariable fields.
42
+ .. [#snapshot-alternative] You can achieve the
43
+ :operator:`$snapshot` isolation behavior using any *unique*
44
+ index on invariable fields.
You can’t perform that action at this time.
0 commit comments