Skip to content

Commit ab6c23d

Browse files
authored
DOCS-14369 fixing create index multiline render (#60)
* DOCS-14369 fixing create index multiline render * Add 5.0 compatibility note
1 parent 47e8a52 commit ab6c23d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

source/core/index-wildcard.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,41 @@ For an example, see :ref:`createIndex-method-wildcard-exclusion`.
185185

186186
.. include:: /includes/extracts/wildcard-index-inclusion-exclusion.rst
187187

188+
.. _normalized_wildcard_indexes:
189+
190+
Viewing Normalized wildcard Indexes
191+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
192+
193+
Starting in MongoDB 5.0, wildcard indexes are normalized after
194+
creation, multiple wildcard indexes can be created using
195+
the same :ref:`key pattern<key_patterns>` as long as the
196+
wildcardProjection fields do not express equivalent filters.
197+
198+
For example, create a wildcard index:
199+
200+
.. code-block:: javascript
201+
202+
db.books.createIndex( { "$**" : 1 }, { wildcardProjection : {a: 1, "b.c": 1 } } )
203+
204+
View the index with the :method:`db.collection.getIndexes()` method:
205+
206+
.. code-block:: javascript
207+
208+
db.books.getIndexes()
209+
210+
The results are displayed in a normalized format:
211+
212+
.. code-block:: javascript
213+
:copyable: false
214+
215+
{ v: 2, key: { _id: 1 }, name: '_id_' },
216+
{
217+
v: 2,
218+
key: { '$**': 1 },
219+
name: '$**_1',
220+
wildcardProjection: { a: true, b: { c: true }, _id: false }
221+
}
222+
188223
Considerations
189224
--------------
190225

source/release-notes/5.0-compatibility.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ Starting in MongoDB 5.0:
404404
``Double()`` constructor with the :dbcommand:`replSetResizeOplog`
405405
command.
406406

407+
- :doc:`Wildcard indexes </core/index-wildcard>` are normalized after
408+
creation. The ``wildcardProjection`` document that defines the index
409+
may contain :ref:`normalized syntax <normalized_wildcard_indexes>`
410+
that differs from the original index creation statements.
411+
407412
Starting in MongoDB 5.0.4 (and 4.4.10), the :query:`$mod`
408413
operator returns an error if the ``divisor`` or ``remainder`` values
409414
evaluate to certain values. See :ref:`$mod behavior <mod-behavior>`.

0 commit comments

Comments
 (0)