Skip to content

Commit 6afe628

Browse files
authored
Update date and enhance example descriptions
1 parent f0f1f7f commit 6afe628

File tree

1 file changed

+35
-33
lines changed
  • articles/cosmos-db/mongodb/vcore/operators/set-expression

1 file changed

+35
-33
lines changed

articles/cosmos-db/mongodb/vcore/operators/set-expression/$setunion.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
ms.service: azure-cosmos-db
88
ms.subservice: mongodb-vcore
99
ms.topic: language-reference
10-
ms.date: 08/03/2025
10+
ms.date: 09/04/2025
1111
---
1212

1313
# $setUnion
@@ -28,9 +28,9 @@ The `$setUnion` operator returns an array that contains all the unique elements
2828
| --- | --- |
2929
| `<array1>, <array2>, ...` | Two or more arrays to combine. Each array is treated as a set, and duplicates are removed from the final result. |
3030

31-
## Example
31+
## Examples
3232

33-
Let's understand the usage with sample JSON from the `stores` dataset.
33+
Consider this sample document from the stores collection.
3434

3535
```json
3636
{
@@ -141,7 +141,7 @@ Let's understand the usage with sample JSON from the `stores` dataset.
141141

142142
### Example 1: Combine all product categories
143143

144-
The following example produces a complete list of all of a store's unique product categories. The list includes sales and promotion categories.
144+
This query retrieves a list of all of a store's unique product categories. The list includes sales and promotion categories.
145145

146146
```javascript
147147
db.stores.aggregate([
@@ -166,37 +166,39 @@ db.stores.aggregate([
166166
])
167167
```
168168

169-
The query returns all the unique categories across all sales and promotions.
169+
This query returns the following result.
170170

171171
```json
172-
{
173-
"_id": "26afb024-53c7-4e94-988c-5eede72277d5",
174-
"name": "First Up Consultants | Microphone Bazaar - South Lexusland",
175-
"salesCategories": [
176-
"Lavalier Microphones",
177-
"Wireless Microphones"
178-
],
179-
"firstPromotionCategories": [
180-
"Condenser Microphones",
181-
"Dynamic Microphones"
182-
],
183-
"secondPromotionCategories": [
184-
"Streaming Microphones",
185-
"Microphone Stands"
186-
],
187-
"thirdPromotionCategories": [
188-
"Condenser Microphones",
189-
"Microphone Stands"
190-
],
191-
"allUniqueCategories": [
192-
"Lavalier Microphones",
193-
"Wireless Microphones",
194-
"Condenser Microphones",
195-
"Dynamic Microphones",
196-
"Streaming Microphones",
197-
"Microphone Stands"
198-
]
199-
}
172+
[
173+
{
174+
"_id": "26afb024-53c7-4e94-988c-5eede72277d5",
175+
"name": "First Up Consultants | Microphone Bazaar - South Lexusland",
176+
"salesCategories": [
177+
"Lavalier Microphones",
178+
"Wireless Microphones"
179+
],
180+
"firstPromotionCategories": [
181+
"Condenser Microphones",
182+
"Dynamic Microphones"
183+
],
184+
"secondPromotionCategories": [
185+
"Streaming Microphones",
186+
"Microphone Stands"
187+
],
188+
"thirdPromotionCategories": [
189+
"Condenser Microphones",
190+
"Microphone Stands"
191+
],
192+
"allUniqueCategories": [
193+
"Lavalier Microphones",
194+
"Wireless Microphones",
195+
"Condenser Microphones",
196+
"Dynamic Microphones",
197+
"Streaming Microphones",
198+
"Microphone Stands"
199+
]
200+
}
201+
]
200202
```
201203

202204
## Related content

0 commit comments

Comments
 (0)