@@ -87,13 +87,13 @@ SQL statement:
87
87
Considerations
88
88
--------------
89
89
90
- Duplicates Results
90
+ Duplicate Results
91
91
~~~~~~~~~~~~~~~~~~
92
92
93
93
The combined results from the previous stage and the
94
94
:pipeline:`$unionWith` stage can include duplicates.
95
95
96
- For example, create a suppliers collection:
96
+ For example, create a `` suppliers`` collection and a ``warehouses`` collection:
97
97
98
98
.. code-block:: javascript
99
99
@@ -111,9 +111,8 @@ For example, create a suppliers collection:
111
111
{ _id: 3, warehouse: "C", region: "East", state: "Florida" },
112
112
])
113
113
114
- The following aggregation which combines the results from the ``state``
115
- field projection from the ``suppliers`` collection with the results
116
- from the ``state`` field projection from the ``warehouse`` collection:
114
+ The following aggregation combines the ``state`` field projection results from
115
+ the ``suppliers`` and ``warehouse`` collections.
117
116
118
117
.. code-block:: javascript
119
118
@@ -122,11 +121,11 @@ from the ``state`` field projection from the ``warehouse`` collection:
122
121
{ $unionWith: { coll: "warehouses", pipeline: [ { $project: { state: 1, _id: 0 } } ]} }
123
122
])
124
123
125
- As can be seen from the returned documents, the result set contains
126
- duplicates:
124
+ The result set contains duplicates:
127
125
128
126
.. code-block:: javascript
129
127
:emphasize-lines: 2,5
128
+ :copyable: false
130
129
131
130
{ "state" : "Texas" }
132
131
{ "state" : "Colorado" }
@@ -149,6 +148,7 @@ group by the ``state`` field:
149
148
The result set no longer contains duplicates:
150
149
151
150
.. code-block:: javascript
151
+ :copyable: false
152
152
153
153
{ "_id" : "California" }
154
154
{ "_id" : "Texas" }
0 commit comments