Skip to content

Commit 13bcdd1

Browse files
committed
embedded doc note
1 parent e149273 commit 13bcdd1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

source/model-data/indexes.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ Embedded Document Index
176176
~~~~~~~~~~~~~~~~~~~~~~~
177177

178178
You can create indexes on fields that store embedded model values,
179-
which MongoDB represents as embedded documents. These indexes are only
180-
used in queries that specify the entire embedded document. Queries
181-
on a specific field within the embedded document do not use the index.
179+
which MongoDB represents as embedded documents.
182180

183181
The following example updates the ``Recipe`` model's ``Meta`` class to create
184182
an index on the ``nutrition`` embedded model field, which {+django-odm+} creates
@@ -191,6 +189,14 @@ on the ``recipes`` collection:
191189
:copyable:
192190
:emphasize-lines: 3-5
193191

192+
.. important::
193+
194+
The index created in the preceding example is only used in queries that
195+
specify the entire embedded document. Queries on a specific field within
196+
the embedded document do not use the index. However, you can index
197+
fields within the embedded document by adding an inner ``Meta`` class
198+
to the ``Nutrition`` model and specifying the ``indexes`` option.
199+
194200
Advanced Index Configuration
195201
----------------------------
196202

0 commit comments

Comments
 (0)