Skip to content

Commit dfe9a53

Browse files
committed
DOCSP-48562: dupe index config (#117)
* DOCSP-48562: dupe index config * MW suggestion (cherry picked from commit 1392457)
1 parent bd47b83 commit dfe9a53

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

source/data-modeling/indexes.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
Optimize Queries With Indexes
66
=============================
77

8-
.. default-domain:: mongodb
9-
108
.. facet::
119
:name: genre
1210
:values: reference
@@ -59,6 +57,16 @@ index and its direction. ``1`` represents an ascending index, and ``-1`` represe
5957
descending index. The second hash object contains index options. To learn more
6058
about index options, see the :ref:`mongoid-indexes-api-documentation` section.
6159

60+
.. note:: Duplicate Indexes
61+
62+
{+odm+} might incorrectly label some index declarations as duplicates
63+
and silently prevent index creation. To change this default behavior and push
64+
index verification to the server, you can set the
65+
``Mongoid.allow_duplicate_index_declarations`` configuration option to ``true``.
66+
Then, if the server detects a duplicate index, it raises an error.
67+
To learn more, see the :ref:`mongoid-config-options-all` section of the
68+
Application Configuration guide.
69+
6270
Aliases and Declaring Indexes
6371
+++++++++++++++++++++++++++++
6472

@@ -217,4 +225,4 @@ To learn more about index options, see the `Mongoid::Indexable::Validators::Opti
217225

218226
To learn more about using Atlas Search indexes in {+odm+}, see the
219227
`Mongoid::SearchIndexable::ClassMethods <{+api+}/Mongoid/SearchIndexable/ClassMethods.html>`__
220-
documentation.
228+
documentation.

source/includes/configuration/sample-config-options.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ development:
123123
# field values. Only has effect when BSON 5+ is present.
124124
allow_bson5_decimal128: false
125125

126+
# Allows duplicate indexes to be declared and sent
127+
# to the server. The server then validates the indexes and raises an
128+
# exception if duplicate indexes are detected. When false, indexes
129+
# are validated on the client, which can lead to some indexes
130+
# getting silently ignored even if they are not duplicates.
131+
# (default: false)
132+
allow_duplicate_index_declarations: false
133+
126134
# Sets app name that is printed to the MongoDB logs upon establishing
127135
# a connection. Value is used as the database name if the database
128136
# name is not provided. (default: nil)

source/whats-new.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,26 @@ What's New
1212

1313
Learn what's new in:
1414

15+
* :ref:`Version 9.1 <mongoid-version-9.1>`
1516
* :ref:`Version 9.0 <mongoid-version-9.0>`
1617

1718
To view a list of releases and detailed release notes, see {+odm+}
1819
:github:`Releases <mongodb/mongoid/releases>` on GitHub.
1920

21+
.. _mongoid-version-9.1:
22+
23+
What's New in 9.1
24+
-----------------
25+
26+
The 9.1 release includes the following new features, improvements, and
27+
fixes:
28+
29+
- Adds the ``Mongoid.allow_duplicate_index_declarations``
30+
configuration option that enables you to send index verification to
31+
the server. If a duplicate index is declared, the server raises an
32+
error. To learn more, see the :ref:`mongoid-config-options-all`
33+
section of the Application Configuration guide.
34+
2035
.. _mongoid-version-9.0:
2136

2237
What's New in 9.0

0 commit comments

Comments
 (0)