@@ -7,9 +7,12 @@ Update Arrays in a Document
77.. contents:: On this page
88 :local:
99 :backlinks: none
10- :depth: 1
10+ :depth: 2
1111 :class: singlecol
1212
13+ Overview
14+ --------
15+
1316If you need to modify an array embedded within a document, you can use an
1417array update operator in your update method call. In this guide, we
1518explain and show examples on usage of these operators including:
@@ -22,8 +25,8 @@ See the MongoDB server guide on
2225:manual:`Update Operators </reference/operator/update-array/#update-operators>`
2326for a complete list.
2427
25- Examples
26- ~~~~~~~~
28+ Sample Documents
29+ ~~~~~~~~~~~~~~~~
2730
2831The following examples use a database called ``test`` and collection
2932called ``pizza`` which contains documents that describe customers and
@@ -89,7 +92,7 @@ the following sample document to follow the example queries:
8992.. _first-match-operator:
9093
9194Match the First Array Element
92- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95+ -----------------------------
9396
9497To perform the update on only the first array element of each document
9598that matches your query document in your update operation, use the ``$``
@@ -144,7 +147,7 @@ in our update, we encounter the following error:
144147.. _all-match-operator:
145148
146149Match All Array Elements
147- ~~~~~~~~~~~~~~~~~~~~~~~~
150+ ------------------------
148151
149152To perform the update on all of the array elements of each document that
150153matches your query document in your update operation, use the all
@@ -184,7 +187,7 @@ resemble the following:
184187.. _filtered-positional-operator:
185188
186189Filtered Positional Operator
187- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190+ ----------------------------
188191
189192In the previous sections, we used the ``$`` operator to match the first
190193array element and the ``$[]`` operator to match all array elements. In this
0 commit comments