Skip to content

DOCS-2652 reword definition of exists operator #1599

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
16 changes: 5 additions & 11 deletions source/reference/operator/query/exists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ Definition

*Syntax*: ``{ field: { $exists: <boolean> } }``

:query:`$exists` selects the documents that contain the field if
``<boolean>`` is ``true``. If ``<boolean>`` is ``false``, the query
only returns the documents that do not contain the
field. :query:`$exists` **does** match documents that contain
the field that stores the ``null`` value.

When you specify ``true`` to the :query:`$exists` operator, the
query will select documents where the value of the specified field
is ``null``. If you specify ``false`` to :query:`$exists`, the
query will **not** match fields that hold the ``null`` value.

When ``<boolean>`` is true, :query:`$exists` matches the documents that
contain the field, including documents where the field value is
``null``. If ``<boolean>`` is false, the query returns only the
documents that do not contain the field.

MongoDB `$exists` does **not** correspond to SQL operator
``exists``. For SQL ``exists``, refer to the :query:`$in`
operator.
Expand Down