Skip to content

Commit 4d41236

Browse files
author
Dave Cuthbert
authored
DOCSP-30735 Inline content for old release notes (#3349)
* DOCSP-30735 Prep old rel notes * Review comments
1 parent 3467a6b commit 4d41236

File tree

3 files changed

+50
-10
lines changed

3 files changed

+50
-10
lines changed

source/core/index-wildcard.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ support queries. Since MongoDB supports dynamic schemas, applications
1717
can query against fields whose names cannot be known in advance or are
1818
arbitrary.
1919

20-
.. versionadded:: MongoDB 4.2
21-
22-
MongoDB 4.2 introduces wildcard indexes for supporting queries
23-
against unknown or arbitrary fields.
24-
2520
.. include:: /includes/extracts/wildcard-index-summary.rst
2621

2722
.. include:: /includes/extracts/wildcard-index-planning.rst
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Consider an application that captures user-defined data under the
2+
``userMetadata`` field and supports querying against that data:
3+
4+
.. code-block:: javascript
5+
:copyable: false
6+
7+
{ "userMetadata" : { "likes" : [ "dogs", "cats" ] } }
8+
{ "userMetadata" : { "dislikes" : "pickles" } }
9+
{ "userMetadata" : { "age" : 45 } }
10+
{ "userMetadata" : "inactive" }
11+
12+
Administrators want to create indexes to support queries on any
13+
subfield of ``userMetadata``.
14+
15+
A wildcard index on ``userMetadata``
16+
can support single-field queries on ``userMetadata``,
17+
``userMetadata.likes``, ``userMetadata.dislikes``, and
18+
``userMetadata.age``:
19+
20+
.. code-block:: bash
21+
22+
db.userData.createIndex( { "userMetadata.$**" : 1 } )
23+
24+
The index can support the following queries:
25+
26+
.. code-block:: bash
27+
:copyable: false
28+
29+
db.userData.find({ "userMetadata.likes" : "dogs" })
30+
db.userData.find({ "userMetadata.dislikes" : "pickles" })
31+
db.userData.find({ "userMetadata.age" : { $gt : 30 } })
32+
db.userData.find({ "userMetadata" : "inactive" })
33+
34+
A non-wildcard index on ``userMetadata`` can only support queries on
35+
values of ``userMetadata``.
36+
37+
.. important::
38+
39+
Wildcard indexes are not designed to replace workload-based index
40+
planning. For more information on creating indexes to support
41+
queries, see :ref:`create-indexes-to-support-queries`. For
42+
complete documentation on wildcard index limitations, see
43+
:ref:`wildcard-index-restrictions`.
44+
45+
46+
The :binary:`~bin.mongod`
47+
:ref:`featureCompatibilityVersion <view-fcv>` must be ``4.2`` to
48+
create wildcard indexes. For instructions on setting the fCV, see
49+
:ref:`Setting the fCV <set-fcv>`.

source/release-notes/4.2.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,11 +1409,7 @@ Wildcard Indexes
14091409
MongoDB 4.2 introduces :ref:`wildcard indexes <wildcard-index-core>` for
14101410
supporting queries against fields whose names are unknown or arbitrary.
14111411

1412-
.. include:: /includes/extracts/wildcard-index-summary.rst
1413-
1414-
.. include:: /includes/extracts/wildcard-index-planning.rst
1415-
1416-
.. include:: /includes/extracts/wildcard-index-fcv.rst
1412+
.. include:: /includes/4.2-changes/wildcard-indexes-refactored.rst
14171413

14181414
You can create a wildcard index using the :dbcommand:`createIndexes`
14191415
database command or its shell helpers

0 commit comments

Comments
 (0)