Skip to content

Commit 11f7bbd

Browse files
authored
(DOCSP-32354): Add Atlas UI steps to Query for Null or Missing Fields page (#4804)
* Add Atlas UI steps to page * copy review feedback * Use new includes files
1 parent 8ecc996 commit 11f7bbd

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.mongosh` 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
@@ -21,14 +21,14 @@ Query for Null or Missing Fields
2121
:backlinks: none
2222
:depth: 1
2323

24-
----------
24+
You can query for ``null`` or missing fields in MongoDB
25+
using the following methods:
2526

26-
.. |arrow| unicode:: U+27A4
27+
.. |atlas-ref| replace:: :ref:`query-null-documents-atlas-ui`
2728

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

31-
----------
31+
.. include:: /includes/language-selector-instructions.rst
3232

3333
.. tabs-selector:: drivers
3434

@@ -364,3 +364,68 @@ The query only returns the document that does *not* contain the
364364
.. [#type0]
365365

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

source/tutorial/update-documents.txt

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

2525
You can update documents in MongoDB using the following methods:
2626

27-
- Your programming language's driver
27+
- Your programming language's driver.
2828
- The :atlas:`{+atlas+} UI </>`. To learn more, see
2929
:ref:`update-documents-atlas-ui`.
30-
- :compass:`MongoDB Compass </>`
30+
- :compass:`MongoDB Compass </>`.
3131

3232
----------
3333

0 commit comments

Comments
 (0)