Skip to content

DOCS_7945 - Added clarifications to covered query explanation and example #2666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions source/core/query-optimization.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ index use <regex-index-use>`.
Covered Query
-------------

An index :ref:`covers <indexes-covered-queries>` a query when both of the
A covered query is a query that can be satisfied entirely using an index
and does not have to examine any documents. An index
:ref:`covers <indexes-covered-queries>` a query when both of the
following apply:

- all the fields in the :ref:`query <read-operations-query-document>`
Expand Down Expand Up @@ -161,15 +163,16 @@ An index **cannot** cover a query if:

{ "user.login": 1 }

The ``{ "user.login": 1 }`` index does **not** cover the
following query:
The ``{ "user.login": 1 }`` index will **not** cover the
query below because this index is on a field in an embedded document:

.. code-block:: none

db.users.find( { "user.login": "tester" }, { "user.login": 1, _id: 0 } )

However, the query can use the ``{ "user.login": 1 }`` index to find
matching documents.
This query can still use the ``{ "user.login": 1 }`` index to find
matching documents but it will examine and fetch documents to satisfy the
query.

.. _covered-index-sharded-collection:

Expand Down