@@ -56,10 +56,9 @@ Definition
56
56
Behavior
57
57
--------
58
58
59
- If the name of a field repeats in the array,
60
- :expression:`$arrayToObject` uses the first value for that field .
59
+ If the name of a field repeats in the array, the value used depends on
60
+ the driver .
61
61
62
- For more information on expressions, see :ref:`aggregation-expressions`.
63
62
64
63
.. list-table::
65
64
:header-rows: 1
@@ -106,6 +105,11 @@ For more information on expressions, see :ref:`aggregation-expressions`.
106
105
107
106
{ "item" : "123abc" }
108
107
108
+ If the name of a field repeats in the array, the value for the
109
+ repeating field depends on the driver. In the
110
+ :binary:`~bin.mongo` shell, the first value is used for the
111
+ repeating field.
112
+
109
113
110
114
Examples
111
115
--------
@@ -142,15 +146,18 @@ document:
142
146
143
147
The operation returns the following:
144
148
149
+ .. note::
150
+
151
+ If the name of a field repeats in the array, the value for the
152
+ repeating field depends on the driver. In the :binary:`~bin.mongo`
153
+ shell, the first value is used for the repeating field.
154
+
145
155
.. code-block:: javascript
146
156
147
157
{ "_id" : 1, "item" : "ABC1", "dimensions" : { "l" : 25, "w" : 10, "uom" : "cm" } }
148
158
{ "_id" : 2, "item" : "ABC2", "dimensions" : { "l" : 50, "w" : 25, "uom" : "cm" } }
149
159
{ "_id" : 3, "item" : "ABC3", "dimensions" : { "l" : 50 } }
150
160
151
- If the name of a field repeats in the array,
152
- :expression:`$arrayToObject` uses the first value for that field.
153
-
154
161
``$objectToArray`` + ``$arrayToObject`` Example
155
162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156
163
0 commit comments