Skip to content

Commit ca4d1bf

Browse files
committed
Update master
1 parent af25316 commit ca4d1bf

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

draft/core/indexes.txt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ indexes:
3131
:ref:`compound index <index-type-compound>`.
3232

3333
- Queries that are "covered" by the index return more quickly
34-
than queries that have to scan many individual documents. An index is
35-
considered to "cover" a query if all the data that the query must return
34+
than queries that have to scan many individual documents. An index
35+
"covers" a query if all the data that the query must return
3636
is stored in within the keys of the index.
3737

3838
- Using queries with good index coverage will reduce the number of full
@@ -69,7 +69,7 @@ _id
6969

7070
The ``_id`` index is a :ref:`unique index <index-type-unique>`
7171
[#unique-index-report]_ on the ``_id`` field, and MongoDB creates this
72-
index by default on all collections. [#capped-collections]_ You cannot
72+
index by default on all collections (except for [#capped-collections]). You cannot
7373
delete the index on ``_id``.
7474

7575
The ``_id`` field is the :term:`primary key` for the collection, and
@@ -80,17 +80,20 @@ are 12-byte, unique identifiers, that make suitable ``_id`` values.
8080

8181
.. note::
8282

83-
In :term:`shard clusters <shard cluster>`, if the you do *not* use
83+
In :term:`shard clusters <shard cluster>`, if you do *not* use
8484
the ``_id`` field as the :term:`shard key`, then your application
8585
**must** ensure the uniqueness of the values in the ``_id`` field
86-
to prevent errors.
86+
to prevent errors. This is most-often done by using the standard
87+
auto-generated :term:`ObjectIds`.
8788

8889
.. [#unique-index-report] Although the index on ``_id`` *is* unique,
8990
the :func:`getIndexes() <db.collection.getIndexes()>` method will
9091
*not* print ``unique: true`` in the :program:`mongo` shell.
9192

92-
.. [#capped-collections] Capped collections are a special collection
93-
which do not have an ``_id`` index.
93+
.. [#capped-collections] Capped collections are special collections
94+
which do not have an ``_id`` index by default.
95+
TODO: figure out what new behavior of capped collections is.
96+
(i think in replset capped collections now have _id by default)
9497

9598
.. _index-types-secondary:
9699

@@ -109,9 +112,9 @@ primary, common, and user-facing queries and require MongoDB to scan
109112
the fewest number of documents possible.
110113

111114
To create a secondary index, use the :func:`ensureIndex()`
112-
method. The specifications an index using the :func:`ensureIndex()
113-
<db.collection.ensureIndex()>` operation will resemble the following
114-
on the MongoDB shell:
115+
method. The argument to :func:`ensureIndex()
116+
<db.collection.ensureIndex()>` will resemble the following
117+
in the MongoDB shell:
115118

116119
.. code-block:: javascript
117120

@@ -142,7 +145,7 @@ documents that resemble the following example document:
142145
}
143146
}
144147

145-
You could create an index on the ``address.zipcode`` field, using the
148+
You can create an index on the ``address.zipcode`` field, using the
146149
following specification:
147150

148151
.. code-block:: javascript
@@ -160,7 +163,7 @@ Compound Indexes
160163
MongoDB supports "compound indexes," where a single index structure
161164
holds references to multiple fields within a collection's
162165
documents. Consider the collection ``products`` that holds documents
163-
that resemble the following an example document:
166+
that resemble the following example document:
164167

165168
.. code-block:: javascript
166169

0 commit comments

Comments
 (0)