Skip to content

Commit 46fbd09

Browse files
authored
(DOCSP-32354): Add Atlas UI steps to Query for Null or Missing Fields page (#4804) (#4894)
* Add Atlas UI steps to page * copy review feedback * Use new includes files
1 parent 6f57d51 commit 46fbd09

File tree

3 files changed

+73
-8
lines changed

3 files changed

+73
-8
lines changed

source/reference/operator/query.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Compatibility
2626

2727
You can use operators when querying your data
2828
with :binary:`~bin.mongo` methods, the
29-
:atlas:`Atlas UI </atlas/atlas-ui/>`, or :compass:`Compass </>`.
29+
:atlas:`Atlas UI </atlas-ui/>`, or :compass:`Compass </>`.
3030

3131
.. _query-selectors:
3232

source/tutorial/query-for-null-fields.txt

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Query for Null or Missing Fields
1414
:backlinks: none
1515
:depth: 1
1616

17-
----------
17+
You can query for ``null`` or missing fields in MongoDB
18+
using the following methods:
1819

19-
.. |arrow| unicode:: U+27A4
20+
.. |atlas-ref| replace:: :ref:`query-null-documents-atlas-ui`
2021

21-
|arrow| Use the **Select your language** drop-down menu in the
22-
upper-right to set the language of the following examples.
22+
.. include:: /includes/fact-methods.rst
2323

24-
----------
24+
.. include:: /includes/language-selector-instructions.rst
2525

2626
.. tabs-selector:: drivers
2727

@@ -370,3 +370,68 @@ The query only returns the document that does *not* contain the
370370
.. [#type0]
371371

372372
.. include:: /includes/extracts/4.2-changes-type-0.rst
373+
374+
.. _query-null-documents-atlas-ui:
375+
376+
Query for Null or Missing Fields with {+atlas+}
377+
----------------------------------------------------
378+
379+
The example in this section uses the :atlas:`sample training dataset
380+
</sample-data/sample-training/>`. To learn how to load the sample dataset
381+
into your {+atlas+} deployment, see :atlas:`Load Sample Data
382+
</sample-data/#std-label-load-sample-data>`.
383+
384+
To query for a ``null`` or missing field in {+atlas+}, follow these steps:
385+
386+
.. procedure::
387+
:style: normal
388+
389+
.. step:: Navigate to the collection.
390+
391+
a. In the :atlas:`Atlas UI </atlas-ui/>`, click :guilabel:`Database` in the sidebar.
392+
#. For the database deployment that contains the sample data, click :guilabel:`Browse Collections`.
393+
#. In the left navigation pane, select the ``sample_training`` database.
394+
#. Select the ``companies`` collection.
395+
396+
.. step:: Insert a blank document.
397+
398+
Click the :guilabel:`Insert Document` button to display the
399+
dialog box, and then click :guilabel:`Insert`
400+
to insert a document with only the ``_id`` field.
401+
402+
.. step:: Specify a query filter document.
403+
404+
To find a document that contains a ``null`` or missing value,
405+
specify a :ref:`query filter document <document-query-filter>`
406+
in the :guilabel:`Filter` field. A query filter document uses
407+
:ref:`query operators <csfle-supported-query-operators>`
408+
to specify search conditions.
409+
410+
Different query operators in MongoDB treat ``null`` values differently.
411+
To apply a query filter, copying each of the following documents into the
412+
:guilabel:`Filter` search bar and click :guilabel:`Apply`.
413+
414+
Use the following query filter to match documents that either contain a
415+
``description`` field with a ``null`` value or do not contain the
416+
``description`` field:
417+
418+
.. code-block:: javascript
419+
420+
{ description : null }
421+
422+
Use the following query filter to match only documents that contain
423+
a ``description`` field with a ``null`` value. This filter specifies
424+
that the value of the field must be :ref:`BSON Type <bson-types>` ``Null``
425+
(BSON Type 10):
426+
427+
.. code-block:: javascript
428+
429+
{ description : { $type: 10 } }
430+
431+
Use the following query filter to match only documents that
432+
do not contain the ``description`` field. Only the document
433+
that you inserted earlier should appear:
434+
435+
.. code-block:: javascript
436+
437+
{ description : { $exists: false } }

source/tutorial/update-documents.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Update Documents
2020

2121
You can update documents in MongoDB using the following methods:
2222

23-
- Your programming language's driver
23+
- Your programming language's driver.
2424
- The :atlas:`{+atlas+} UI </>`. To learn more, see
2525
:ref:`update-documents-atlas-ui`.
26-
- :compass:`MongoDB Compass </>`
26+
- :compass:`MongoDB Compass </>`.
2727

2828
----------
2929

0 commit comments

Comments
 (0)