You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/mongodb/vcore/operators/set-expression/$setissubset.md
+28-26Lines changed: 28 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
ms.service: azure-cosmos-db
8
8
ms.subservice: mongodb-vcore
9
9
ms.topic: language-reference
10
-
ms.date: 06/09/2025
10
+
ms.date: 09/04/2025
11
11
---
12
12
13
13
# $setIsSubset
@@ -29,9 +29,9 @@ The `$setIsSubset` operator returns a Boolean value that indicates if one array
29
29
|`<array1>`| The array to check to see if it's a subset of `<array2>`. |
30
30
|`<array2>`| The array to check against. |
31
31
32
-
## Example
32
+
## Examples
33
33
34
-
Let's understand the usage with sample JSON from the `stores` dataset.
34
+
Consider this sample document from the stores collection.
35
35
36
36
```json
37
37
{
@@ -120,7 +120,7 @@ Let's understand the usage with sample JSON from the `stores` dataset.
120
120
121
121
### Example 1: Determine if sales categories are a subset of promotion categories
122
122
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).
124
124
125
125
```javascript
126
126
db.stores.aggregate([
@@ -147,30 +147,32 @@ db.stores.aggregate([
147
147
])
148
148
```
149
149
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.
151
151
152
152
```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",
0 commit comments