Skip to content

Commit

Permalink
(DOCSP-36307) Backport to 4.4 (#6283) (#6287)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-allen-mongo authored Feb 7, 2024
1 parent 66d7bcd commit 04dfa10
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions source/core/index-single.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ Create an Index on Embedded Document

You can also create indexes on embedded document as a whole.

.. include:: /includes/indexes/embedded-object-need-entire-doc.rst

Consider a collection named ``schools`` that holds documents that
resemble the following sample document:

Expand Down
3 changes: 3 additions & 0 deletions source/includes/indexes/embedded-object-need-entire-doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
When you create an index on an embedded document, only queries that
specify the entire embedded document use the index. Queries on a
specific field within the document do not use the index.
11 changes: 8 additions & 3 deletions source/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ example, consider the following scenarios:
* - A salesperson often needs to look up client information by
location. Location is stored in an embedded object with fields
like ``state``, ``city``, and ``zipcode``. You can create an
index on the entire ``location`` object to improve performance
for queries on any field in that object.
index on the ``location`` object to improve performance for
queries on that object.

- :ref:`Single Field Index <indexes-single-field>` on an object
.. note::

.. include:: /includes/indexes/embedded-object-need-entire-doc.rst

- :ref:`Single Field Index <indexes-single-field>` on an embedded
document

* - A grocery store manager often needs to look up inventory items by
name and quantity to determine which items are low stock. You can
Expand Down

0 comments on commit 04dfa10

Please sign in to comment.