Skip to content

Commit a84f40e

Browse files
committed
DOCS-11906: 4.2 fcv index name limit
1 parent d98f9d1 commit a84f40e

11 files changed

+138
-50
lines changed

source/includes/apiargs-method-db.collection.createIndex-options-param.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ description: |
3535
The name of the index. If unspecified, MongoDB generates an index name
3636
by concatenating the names of the indexed fields and the sort order.
3737
38-
Whether user specified or MongoDB generated, index names including
39-
their full namespace (i.e. ``database.collection``) cannot be longer
40-
than the :limit:`Index Name Limit <Index Name Length>`.
38+
.. admonition:: Changed in MongoDB 4.2
39+
:class: note
40+
41+
.. include:: /includes/extracts/4.2-changes-index-names.rst
42+
4143
interface: method
4244
name: name
4345
operation: db.collection.createIndex
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ref: 4.2-changes-index-names
2+
content: |
3+
4+
Starting in version 4.2, for :ref:`featureCompatibilityVersion
5+
<view-fcv>` set to ``"4.2"`` or greater, MongoDB removes the
6+
:limit:`Index Name Length` limit of 127 byte maximum. In previous
7+
versions or MongoDB versions with
8+
:ref:`featureCompatibilityVersion <view-fcv>` (fCV) set to
9+
``"4.0"``, index names must fall within the
10+
:limit:`limit <Index Name Length>`.
11+
...
12+
Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
ref: 4.2-downgrade-fcv-index-key
22
content: |
33
4-
Starting in MongoDB 4.2, for ``featureCompatibilityVersion`` set to
5-
``"4.2"`` or greater, MongoDB removes the :limit:`Index Key Limit`. For
6-
``featureCompatibilityVersion`` set to ``"4.0"``, the limit still
7-
applies.
4+
Starting in MongoDB 4.2, for ``featureCompatibilityVersion`` (fCV)
5+
set to ``"4.2"`` or greater, MongoDB removes the :limit:`Index Key
6+
Limit`. For fCV set to ``"4.0"``, the limit still applies.
87
98
If you have an index with keys that exceed the :limit:`Index Key
10-
Limit` once ``featureCompatibilityVersion`` is set to ``"4.0"``,
9+
Limit` once fCV is set to ``"4.0"``,
1110
consider changing the index to a hashed index or to indexing a
1211
computed value. You can also **temporarily** use
1312
:parameter:`failIndexKeyTooLong` set to ``false`` before resolving
14-
the problem. However, withs :parameter:`failIndexKeyTooLong` set to
13+
the problem. However, with :parameter:`failIndexKeyTooLong` set to
1514
``false``, queries that use these indexes can return incomplete
1615
results.
16+
---
17+
ref: 4.2-downgrade-fcv-index-name
18+
content: |
19+
20+
Starting in MongoDB 4.2, for ``featureCompatibilityVersion`` (fCV)
21+
set to ``"4.2"`` or greater, MongoDB removes the :limit:`Index Key
22+
Limit`. For fCV set to ``"4.0"``, the limit still applies.
23+
24+
If you have an index with a name that exceeds the :limit:`Index Name
25+
Length` once fCV is set to ``"4.0"``,
26+
drop and recreate the index with a shorter name.
27+
28+
.. code-block:: javascript
29+
30+
db.collection.dropIndex( <name | index specification> )
31+
32+
db.collection.createIndex(
33+
{ <index specification> },
34+
{ name: <shorter name> }
35+
}
1736
37+
.. see:: :method:`db.collection.dropIndex()` and :method:`db.collection.createIndex()`
1838
...

source/reference/command/createIndexes.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ Considerations
7070
Index Names
7171
~~~~~~~~~~~
7272

73-
An index name, including the :term:`namespace`, cannot be longer than
74-
the :ref:`Index Name Length <limit-index-name-length>` limit.
73+
.. admonition:: Changed in MongoDB 4.2
74+
:class: note
75+
76+
.. include:: /includes/extracts/4.2-changes-index-names.rst
7577

7678
Replica Sets and Sharded Clusters
7779
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

source/reference/limits.txt

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,19 @@ Indexes
113113
.. _limit-index-size:
114114
.. limit:: Index Key Limit
115115

116-
.. versionchanged:: 4.2
117116

118-
MongoDB removes the :limit:`Index Key Limit` for fCV set to
119-
``"4.2"`` or greater.
117+
.. admonition:: Changed in version 4.2
118+
:class: note
119+
120+
Starting in version 4.2, MongoDB removes the :limit:`Index Key
121+
Limit` for :ref:`featureCompatibilityVersion <view-fcv>` (fCV)
122+
set to ``"4.2"`` or greater.
120123

121-
For MongoDB 2.6 through MongoDB versions with
122-
:ref:`featureCompatibilityVersion <view-fcv>` (fCV) set to ``"4.0"``
123-
or earlier, the *total size* of an index entry, which can include
124+
For MongoDB 2.6 through MongoDB versions with fCV set to ``"4.0"`` or
125+
earlier, the *total size* of an index entry, which can include
124126
structural overhead depending on the BSON type, must be *less than*
125127
1024 bytes.
126128

127-
.. COMMENT refer to src/mongo/db/structure/btree/key.cpp (KeyV1Owned::KeyV1Owned)
128-
129129
.. |limit| replace:: :limit:`index key limit <Index Key Limit>`
130130

131131
.. include:: /includes/list-index-field-limit-behaviors.rst
@@ -138,14 +138,24 @@ Indexes
138138
.. _limit-index-name-length:
139139
.. limit:: Index Name Length
140140

141-
Fully qualified index names, which includes the namespace and the dot
142-
separators (i.e. ``<database name>.<collection name>.$<index name>``),
143-
cannot be longer than 128 characters.
141+
.. admonition:: Changed in version 4.2
142+
:class: note
143+
144+
Starting in version 4.2, MongoDB removes the :limit:`Index Key
145+
Limit` for MongoDB versions with
146+
:ref:`featureCompatibilityVersion <view-fcv>` (fCV) set to
147+
``"4.2"`` or greater.
148+
149+
In previous versions of MongoDB or MongoDB versions with fCV set
150+
to ``"4.0"`` or earlier, fully qualified index names, which include
151+
the namespace and the dot separators (i.e. ``<database
152+
name>.<collection name>.$<index name>``), cannot be longer than 127
153+
bytes.
144154

145155
By default, ``<index name>`` is the concatenation of the field names
146-
and index type. You can explicitly specify the ``<index name>`` to the
147-
:method:`~db.collection.createIndex()` method to ensure that the fully
148-
qualified index name does not exceed the limit.
156+
and index type. You can explicitly specify the ``<index name>`` to
157+
the :method:`~db.collection.createIndex()` method to ensure that the
158+
fully qualified index name does not exceed the limit.
149159

150160
.. limit:: Number of Indexed Fields in a Compound Index
151161

source/release-notes/4.2-compatibility.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,6 @@ features include:
239239
:parameter:`failIndexKeyTooLong` parameter has no effect for MongoDB
240240
versions with fCV set to 4.2+ and only applies for MongoDB 2.6
241241
through MongoDB versions with fCV set to ``"4.0"`` or earlier.
242+
243+
- Removal of :limit:`Index Name Length` for MongoDB versions with fCV
244+
set to 4.2+.

source/release-notes/4.2-downgrade-replica-set.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ versions as generally outlined below. These steps are necessary only if
4141

4242
.. _4.2-downgrade-feature-compatibility-rs:
4343

44-
1. Downgrade Feature Compatibility Version
45-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44+
1. Downgrade Feature Compatibility Version (fCV)
45+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4646

4747
.. tip::
4848

@@ -80,11 +80,22 @@ value, see :ref:`view-fcv`.
8080
2. Remove Backwards Incompatible Persisted Features
8181
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8282

83+
Remove all persisted 4.2 features that are :ref:`incompatible with 4.0
84+
<4.2-compatibility-enabled>`.
85+
8386
Index Key Size
8487
``````````````
8588

86-
.. include:: /includes/extracts/4.2-downgrade-fcv-index-key.rst
89+
.. container::
90+
91+
.. include:: /includes/extracts/4.2-downgrade-fcv-index-key.rst
92+
93+
Index Name Length
94+
`````````````````
95+
96+
.. container::
8797

98+
.. include:: /includes/extracts/4.2-downgrade-fcv-index-name.rst
8899

89100
Procedure
90101
---------

source/release-notes/4.2-downgrade-sharded-cluster.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ Create Backup
3030
Prerequisites
3131
-------------
3232

33-
Before downgrading the binaries, you must downgrade the feature
34-
compatibility version and remove any |newversion| features :ref:`incompatible
35-
<4.2-compatibility-enabled>` with |oldversion| or earlier versions as outlined
36-
below. These steps are necessary only if
37-
``featureCompatibilityVersion`` has ever been set to ``"4.2"``.
33+
Before downgrading the binaries, you must downgrade the
34+
``featureCompatibilityVersion`` (fCV) and remove any |newversion|
35+
features :ref:`incompatible <4.2-compatibility-enabled>` with
36+
|oldversion| or earlier versions as outlined below. These steps are
37+
necessary only if fCV has ever been set to ``"4.2"``.
3838

3939
.. |target| replace:: :binary:`~bin.mongos` instance
4040

4141
.. _4.2-downgrade-feature-compatibility-sharded-cluster:
4242

43-
1. Downgrade Feature Compatibility Version
44-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43+
1. Downgrade Feature Compatibility Version (fCV)
44+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4545

4646
#. Connect a :binary:`~bin.mongo` shell to the |target|.
4747

@@ -78,11 +78,22 @@ value, see :ref:`view-fcv`.
7878
2. Remove Backwards Incompatible Persisted Features
7979
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8080

81+
Remove all persisted 4.2 features that are :ref:`incompatible with 4.0
82+
<4.2-compatibility-enabled>`.
83+
8184
Index Key Size
8285
``````````````
8386

84-
.. include:: /includes/extracts/4.2-downgrade-fcv-index-key.rst
87+
.. container::
88+
89+
.. include:: /includes/extracts/4.2-downgrade-fcv-index-key.rst
90+
91+
Index Name Length
92+
`````````````````
93+
94+
.. container::
8595

96+
.. include:: /includes/extracts/4.2-downgrade-fcv-index-name.rst
8697

8798
Procedure
8899
---------

source/release-notes/4.2-downgrade-standalone.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ Create Backup
3232
Prerequisites
3333
-------------
3434

35-
Before downgrading the binaries, you must downgrade the feature
36-
compatibility version and remove any |newversion| features
37-
:ref:`incompatible <4.2-compatibility-enabled>` with |oldversion|
38-
versions as outlined below. These steps are necessary only if
39-
``featureCompatibilityVersion`` has ever been set to ``"4.2"``.
35+
Before downgrading the binaries, you must downgrade the
36+
``featureCompatibilityVersion`` (fCV) and remove any |newversion|
37+
features :ref:`incompatible <4.2-compatibility-enabled>` with
38+
|oldversion| versions as outlined below. These steps are necessary only
39+
if fCV has ever been set to ``"4.2"``.
4040

4141
.. |target| replace:: :binary:`~bin.mongod` instance
4242

4343
.. _4.2-downgrade-feature-compatibility-standalone:
4444

45-
1. Downgrade Feature Compatibility Version
46-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
1. Downgrade Feature Compatibility Version (fCV)
46+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4747

4848
#. Connect a :binary:`~bin.mongo` shell to the |target|.
4949

@@ -52,11 +52,22 @@ versions as outlined below. These steps are necessary only if
5252
2. Remove Backwards Incompatible Persisted Features
5353
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5454

55+
Remove all persisted 4.2 features that are :ref:`incompatible with 4.0
56+
<4.2-compatibility-enabled>`.
57+
5558
Index Key Size
5659
``````````````
5760

58-
.. include:: /includes/extracts/4.2-downgrade-fcv-index-key.rst
61+
.. container::
62+
63+
.. include:: /includes/extracts/4.2-downgrade-fcv-index-key.rst
64+
65+
Index Name Length
66+
`````````````````
67+
68+
.. container::
5969

70+
.. include:: /includes/extracts/4.2-downgrade-fcv-index-name.rst
6071

6172
Procedure
6273
---------

source/release-notes/4.2.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ Starting in MongoDB 4.2, for :ref:`featureCompatibilityVersion
265265
:limit:`Index Key Limit`. For fCV set to ``"4.0"``, the limit still
266266
applies.
267267

268+
Remove Index Name Length Limit
269+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270+
271+
.. include:: /includes/extracts/4.2-changes-index-names.rst
272+
268273
.. seealso:: :ref:`4.2-compatibility-enabled`
269274

270275
Externally Sourced Values for Configuration Files

source/tutorial/avoid-text-index-name-limit.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Specify Name for ``text`` Index
1010
:depth: 1
1111
:class: singlecol
1212

13+
.. admonition:: Changed in MongoDB 4.2
14+
:class: note
15+
16+
.. include:: /includes/extracts/4.2-changes-index-names.rst
17+
1318
The default name for the index consists of each indexed field name
1419
concatenated with ``_text``. For example, the following command creates
1520
a ``text`` index on the fields ``content``, ``users.comments``, and
@@ -31,15 +36,11 @@ The default name for the index is:
3136

3237
"content_text_users.comments_text_users.profiles_text"
3338

34-
The ``text`` index, like other indexes, must fall within the
35-
:limit:`index name length limit <Index Name Length>`.
36-
3739
Specify a Name for ``text`` Index
3840
---------------------------------
3941

40-
To avoid creating an index with a name that exceeds the :limit:`index
41-
name length limit <Index Name Length>`, you can pass the ``name``
42-
option to the :method:`db.collection.createIndex()` method:
42+
You can pass the ``name`` option to the
43+
:method:`db.collection.createIndex()` method:
4344

4445
.. code-block:: javascript
4546

0 commit comments

Comments
 (0)