Skip to content

Commit 62629c2

Browse files
authored
DOCSP 32904 emphasizing dot notation (#4781) (#4946)
* DOCSP-32904 emphasizing dot notation for querying embedded fields * DOCSP-32904 emphasizing dot notation for querying embedded fields * DOCSP-32904 tech edit
1 parent 4ba9761 commit 62629c2

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

source/tutorial/query-embedded-documents.txt

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,11 @@ methods:
3636

3737
.. include:: /includes/driver-examples/driver-example-query-14.rst
3838

39-
Match an Embedded/Nested Document
40-
---------------------------------
41-
42-
.. include:: /includes/extracts/filter-equality-embedded.rst
43-
44-
For example, the following query selects all documents where the field
45-
``size`` equals the document ``{ h: 14, w: 21, uom: "cm" }``:
46-
47-
.. include:: /includes/driver-examples/driver-example-query-15.rst
48-
49-
Equality matches on the whole embedded document require an *exact*
50-
match of the specified ``<value>`` document, including the field order.
51-
For example, the following query does not match any documents in the
52-
``inventory`` collection:
53-
54-
.. include:: /includes/driver-examples/driver-example-query-16.rst
55-
56-
Query on Nested Field
57-
---------------------
39+
Query on Nested Field with Dot Notation
40+
---------------------------------------
5841

5942
To specify a query condition on fields in an embedded/nested document,
60-
use :term:`dot notation` (``"field.nestedField"``).
43+
use :term:`dot notation` (``"field.nestedField"``).
6144

6245
.. note::
6346

@@ -91,6 +74,32 @@ is less than ``15``, the nested field ``uom`` equals ``"in"``, and the
9174

9275
.. include:: /includes/driver-examples/driver-example-query-19.rst
9376

77+
Match an Embedded/Nested Document
78+
---------------------------------
79+
80+
.. include:: /includes/extracts/filter-equality-embedded.rst
81+
82+
For example, the following query selects all documents where the field
83+
``size`` equals the document ``{ h: 14, w: 21, uom: "cm" }``:
84+
85+
.. include:: /includes/driver-examples/driver-example-query-15.rst
86+
87+
88+
.. warning::
89+
90+
MongoDB does not recommend equality matches on embedded documents
91+
because the operations require an *exact* match of the specified ``<value>``
92+
document, including the field order.
93+
94+
For example, the following query does not match any documents in the
95+
``inventory`` collection:
96+
97+
.. include:: /includes/driver-examples/driver-example-query-16.rst
98+
99+
The result of queries that use equality matches on embedded documents
100+
is undefined when used with a driver that does not use ordered data
101+
structures for expressing queries.
102+
94103
.. _query-embedded-documents-atlas-ui:
95104

96105
Query Embedded Documents with {+atlas+}

0 commit comments

Comments
 (0)