File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
source/reference/operator/meta Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -46,19 +46,20 @@ Use ``-1`` to return documents in the reverse order as they occur on disk:
46
46
Natural Order Comparison
47
47
~~~~~~~~~~~~~~~~~~~~~~~~
48
48
49
- In this scenario :
49
+ To demonstrate natural ordering :
50
50
51
- - Create an extra index as { normal: 1 }.
51
+ - Create an `` { normal: 1 }`` index on a collection (e.g. ``coll``) .
52
52
53
- - Insert relevant objects with ``_id`` and ``normal`` values, for example,
54
- a string type object created with:
53
+ - Insert relevant objects with ``_id`` and ``normal`` values, for
54
+ example, a document with ``_id`` and ``normal`` fields that both
55
+ hold the same string:
55
56
56
57
.. code-block:: javascript
57
58
58
59
db.coll.insert( { _id: "01", normal: "01" } )
59
60
60
- - Use a different type for member values for each distinct object, with the
61
- same values in each object.
61
+ - Use values with different types for each document, but both fields
62
+ in the document should have the same value:
62
63
63
64
- Use ``.find().sort().explain()`` for all operations.
64
65
@@ -71,10 +72,10 @@ and a description of the :method:`~cursor.explain()` method output:
71
72
:header-rows: 2
72
73
:widths: 20 25 25 25
73
74
74
- * -
75
- -
75
+ * -
76
+ -
76
77
- :method:`~cursor.sort()`
77
- -
78
+ -
78
79
79
80
* - :method:`~db.collection.find()`
80
81
- :operator:`$natural`:1
You can’t perform that action at this time.
0 commit comments