Skip to content

Commit f0f1f7f

Browse files
authored
Update $setIsSubset documentation
1 parent bc96e3f commit f0f1f7f

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

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

Lines changed: 28 additions & 26 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: 06/09/2025
10+
ms.date: 09/04/2025
1111
---
1212

1313
# $setIsSubset
@@ -29,9 +29,9 @@ The `$setIsSubset` operator returns a Boolean value that indicates if one array
2929
| `<array1>` | The array to check to see if it's a subset of `<array2>`. |
3030
| `<array2>` | The array to check against. |
3131

32-
## Example
32+
## Examples
3333

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

3636
```json
3737
{
@@ -120,7 +120,7 @@ Let's understand the usage with sample JSON from the `stores` dataset.
120120

121121
### Example 1: Determine if sales categories are a subset of promotion categories
122122

123-
The following example helps you determine if all of a store's categories are included in their promotion discounts, and vice versa.
123+
This query determines if all of a store's categories are included in their promotion discounts, and vice versa. This query returns categories included under both the sales and promotion brackets. It confirms that the `sales` value is a subset of a particular promotion category (but doesn't do the reverse).
124124

125125
```javascript
126126
db.stores.aggregate([
@@ -147,30 +147,32 @@ db.stores.aggregate([
147147
])
148148
```
149149

150-
The query returns categories included under both the sales and promotion brackets. It confirms that the `sales` value is a subset of a particular promotion category (but doesn't do the reverse).
150+
This query returns the following result.
151151

152152
```json
153-
{
154-
"_id": "2cf3f885-9962-4b67-a172-aa9039e9ae2f",
155-
"name": "First Up Consultants | Bed and Bath Center - South Amir",
156-
"salesCategories": [
157-
"Mattress Toppers"
158-
],
159-
"promotionCategories": [
160-
"Bath Accessories",
161-
"Pillow Top Mattresses",
162-
"Bathroom Scales",
163-
"Towels",
164-
"Bathrobes",
165-
"Mattress Toppers",
166-
"Hand Towels",
167-
"Shower Heads",
168-
"Bedspreads",
169-
"Bath Mats"
170-
],
171-
"salesAreSubsetOfPromotions": true,
172-
"promotionsAreSubsetOfSales": false
173-
}
153+
[
154+
{
155+
"_id": "2cf3f885-9962-4b67-a172-aa9039e9ae2f",
156+
"name": "First Up Consultants | Bed and Bath Center - South Amir",
157+
"salesCategories": [
158+
"Mattress Toppers"
159+
],
160+
"promotionCategories": [
161+
"Bath Accessories",
162+
"Pillow Top Mattresses",
163+
"Bathroom Scales",
164+
"Towels",
165+
"Bathrobes",
166+
"Mattress Toppers",
167+
"Hand Towels",
168+
"Shower Heads",
169+
"Bedspreads",
170+
"Bath Mats"
171+
],
172+
"salesAreSubsetOfPromotions": true,
173+
"promotionsAreSubsetOfSales": false
174+
}
175+
]
174176
```
175177

176178
## Related content

0 commit comments

Comments
 (0)