Skip to content

Commit 6bca00e

Browse files
committed
DOCSP-2680: reindex clarifications
1 parent 961ed90 commit 6bca00e

File tree

4 files changed

+27
-64
lines changed

4 files changed

+27
-64
lines changed

source/includes/driver-rebuild-indexes-tabs.rst

Lines changed: 0 additions & 33 deletions
This file was deleted.

source/reference/command/reIndex.txt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,34 @@ reIndex
1515
The :dbcommand:`reIndex` command drops all indexes on a
1616
collection and recreates them. This operation may be expensive for
1717
collections that have a large amount of data and/or a large number
18-
of indexes. Use the following syntax:
18+
of indexes.
19+
20+
.. warning::
21+
22+
- For most users, the :dbcommand:`reIndex` command is unnecessary.
23+
24+
- Avoid running :dbcommand:`reIndex` for a replica set.
25+
26+
- Do not run :dbcommand:`reIndex` for a sharded cluster.
27+
28+
Use the following syntax:
1929

2030
.. code-block:: javascript
2131

2232
{ reIndex: "collection" }
2333

24-
Normally, MongoDB compacts indexes during routine updates. For most
25-
users, the :dbcommand:`reIndex` command is unnecessary. However, it
26-
may be worth running if the collection size has changed significantly
27-
or if the indexes are consuming a disproportionate amount of disk space.
34+
The :binary:`~bin.mongo` shell provides a wrapper :method:`db.collection.reIndex()`.
2835

29-
Call :dbcommand:`reIndex` using the following form:
36+
Behavior
37+
--------
3038

31-
.. code-block:: javascript
39+
.. |cmd-name| replace:: :dbcommand:`reIndex`
40+
.. include:: /includes/note-reindex-impact-on-replica-sets.rst
41+
42+
.. include:: /includes/important-reindex-locking.rst
3243

33-
db.collection.reIndex();
3444

35-
.. |cmd-name| replace:: :dbcommand:`reIndex`
36-
.. include:: /includes/note-reindex-impact-on-replica-sets.rst
3745

38-
.. include:: /includes/important-reindex-locking.rst
3946

4047
.. see:: :doc:`/core/index-creation` for more information on the
4148
behavior of indexing operations in MongoDB.

source/reference/method/db.collection.reIndex.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ db.collection.reIndex()
1717
collections that have a large amount of data and/or a large number
1818
of indexes.
1919

20-
Call this method, which takes no arguments, on a collection
21-
object. For example:
20+
.. warning::
2221

23-
.. code-block:: javascript
22+
- For most users, the :method:`db.collection.reIndex()` operation
23+
is unnecessary.
2424

25-
db.collection.reIndex()
25+
- Avoid running :method:`db.collection.reIndex()` against a
26+
collection in a replica set.
27+
28+
- Do not run :method:`db.collection.reIndex()` against a
29+
collection in a sharded cluster.
2630

27-
Normally, MongoDB compacts indexes during routine updates. For most
28-
users, the :method:`db.collection.reIndex()` is unnecessary. However, it
29-
may be worth running if the collection size has changed significantly
30-
or if the indexes are consuming a disproportionate amount of disk space.
3131

3232
Behavior
3333
--------

source/tutorial/manage-indexes.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@ Modify an Index
4545

4646
.. include:: /includes/driver-examples/driver-example-modify-index-tabs.rst
4747

48-
.. _rebuild-indexes:
49-
50-
Rebuild Indexes
51-
---------------
52-
53-
.. |cmd-name| replace:: :method:`db.collection.reIndex()`
54-
55-
.. |limit| replace:: :limit:`Maximum Index Key Length <Index Key>`
56-
57-
.. include:: /includes/driver-rebuild-indexes-tabs.rst
58-
5948
.. tabs-drivers::
6049

6150
tabs:
@@ -64,4 +53,4 @@ Rebuild Indexes
6453
.. seealso::
6554

6655
- :ref:`MongoDB Compass Documentation <compass-index>`
67-
- `Compass Documentation for Indexes <https://docs.mongodb.com/compass/master/indexes/>`_
56+
- `Compass Documentation for Indexes <https://docs.mongodb.com/compass/master/indexes/>`_

0 commit comments

Comments
 (0)