Skip to content

Commit 6848eeb

Browse files
author
Sam Kleinman
committed
edits to $exists
1 parent 0649943 commit 6848eeb

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

source/reference/operator/exists.txt

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ $exists
1010

1111
:operator:`$exists` selects the documents that contain the field if
1212
``<boolean>`` is ``true``. If ``<boolean>`` is ``false``, the query
13-
only returns the documents that do not contain the field. Documents
14-
that contain the value ``null`` are returned if one checks that field :operator:`$exists`
15-
and are not returned when using "$exists: ``false``" (since ``null``
16-
is a valid value).
13+
only returns the documents that do not contain the
14+
field.
15+
16+
When you specify ``true`` to the :operator:`$exist` operator, the
17+
query will select documents where the value of the specified field
18+
is ``null``. If you specify ``false`` to :operator:`$exist`, the
19+
query will **not** match fields that hold the ``null`` value.
1720

1821
MongoDB `$exists` does **not** correspond to SQL operator
1922
``exists``. For SQL ``exists``, refer to the :operator:`$in`
@@ -29,14 +32,6 @@ $exists
2932
where the ``qty`` field exists *and* its value does not equal either
3033
``5`` nor ``15``.
3134

32-
.. seealso::
33-
34-
- :method:`~db.collection.find()`
35-
36-
- :operator:`$nin`
37-
38-
- :operator:`$and`
39-
40-
- :operator:`$in`
41-
42-
- :ref:`faq-developers-query-for-nulls`
35+
.. seealso:: :method:`~db.collection.find()`, :operator:`$nin`,
36+
:operator:`$and`, :operator:`$in`, and
37+
:ref:`faq-developers-query-for-nulls`.

0 commit comments

Comments
 (0)