Skip to content

Commit c720cfd

Browse files
Merge pull request #2984 from abinav2307/logical-query-third-pass-validation
Logical query third pass validation
2 parents fbf2e44 + b105a81 commit c720cfd

File tree

4 files changed

+28
-17
lines changed

4 files changed

+28
-17
lines changed

articles/cosmos-db/mongodb/vcore/operators/logical-query/$and.md

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

1313
# $and
@@ -36,7 +36,7 @@ The `$and` operator performs a logical AND operation on an array of expressions
3636

3737
## Examples
3838

39-
Let's understand the usage with sample json from `stores` dataset.
39+
Consider this sample document from the stores collection.
4040

4141
```json
4242
{
@@ -150,7 +150,7 @@ Let's understand the usage with sample json from `stores` dataset.
150150

151151
### Example 1: Use AND operator as logical-query
152152

153-
The query filters for stores where the number of full-time employees is greater than 10 and part-time employees is less than 15 using the `$and` operator. It projects only the `name` and `staff` fields and limits the result to three records.
153+
This query filters for stores where the number of full-time employees is greater than 10 and part-time employees is less than 15 using the `$and` operator. It projects only the `name` and `staff` fields and limits the result to three records.
154154

155155
```javascript
156156
db.stores.find({
@@ -169,7 +169,7 @@ db.stores.find({
169169
}).limit(3)
170170
```
171171

172-
The query returns up to three stores with high full-time but limited part-time staffing.
172+
The first three results returned by this query are:
173173

174174
```json
175175
[
@@ -208,7 +208,7 @@ The query returns up to three stores with high full-time but limited part-time s
208208

209209
### Example 2: Use AND operator as boolean-expression to find stores with high sales and sufficient staff
210210

211-
The example finds stores that have both total sales greater than 100,000 and more than 30 total staff members.
211+
This query finds stores that have both total sales greater than 100,000 and more than 30 total staff members.
212212

213213
```javascript
214214
db.stores.aggregate([
@@ -231,9 +231,10 @@ db.stores.aggregate([
231231
])
232232
```
233233

234-
The query returns stores that meet both high sales and staffing criteria.
234+
The first two results returned by this query are:
235235

236236
```json
237+
[
237238
{
238239
"_id": "905d1939-e03a-413e-a9c4-221f74055aac",
239240
"name": "Trey Research | Home Office Depot - Lake Freeda",
@@ -246,6 +247,7 @@ The query returns stores that meet both high sales and staffing criteria.
246247
"totalStaff": 27,
247248
"meetsHighPerformanceCriteria": false
248249
}
250+
]
249251
```
250252

251253
## Related content

articles/cosmos-db/mongodb/vcore/operators/logical-query/$nor.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: suvishod
77
ms.service: azure-cosmos-db
88
ms.subservice: mongodb-vcore
99
ms.topic: language-reference
10-
ms.date: 02/12/2025
10+
ms.date: 09/04/2025
1111
---
1212

1313
# $nor
@@ -274,3 +274,4 @@ One of the results returned by this query is:
274274
## Related content
275275

276276
[!INCLUDE[Related content](../includes/related-content.md)]
277+

articles/cosmos-db/mongodb/vcore/operators/logical-query/$not.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The `$not` operator performs a logical NOT operation on a specified expression a
3434

3535
## Examples
3636

37-
Let's understand the usage with sample json from `stores` dataset.
37+
Consider this sample document from the stores collection.
3838

3939
```json
4040
{
@@ -148,7 +148,7 @@ Let's understand the usage with sample json from `stores` dataset.
148148

149149
### Example 1: Use NOT operation as logical-query operator
150150

151-
The example helps to find stores where the number of full-time staff isn't equal to 5 using the `$not` operator with $eq. It returns only the `name` and `staff` fields for up to two such matching documents.
151+
This query retrieves stores where the number of full-time staff isn't equal to 5 using the `$not` operator with $eq. It returns only the `name` and `staff` fields for up to two such matching documents.
152152

153153
```javascript
154154
db.stores.find({
@@ -163,7 +163,7 @@ The example helps to find stores where the number of full-time staff isn't equal
163163
}).limit(2)
164164
```
165165

166-
The query returns up to two stores where full-time staff count differs from 5.
166+
The first two results returned by this query are:
167167

168168
```json
169169
[
@@ -192,7 +192,7 @@ The query returns up to two stores where full-time staff count differs from 5.
192192

193193
### Example 2: Use NOT operator as boolean-expression to identify stores that aren't high-volume
194194

195-
The example finds stores that don't have high sales volume (not greater than 50,000).
195+
This query retrieves stores that don't have high sales volume (not greater than 50,000).
196196

197197
```javascript
198198
db.stores.aggregate([
@@ -216,9 +216,10 @@ db.stores.aggregate([
216216
])
217217
```
218218

219-
The query identifies stores that aren't high-volume.
219+
The first two results returned by this query are:
220220

221221
```json
222+
[
222223
{
223224
"_id": "905d1939-e03a-413e-a9c4-221f74055aac",
224225
"name": "Trey Research | Home Office Depot - Lake Freeda",
@@ -233,8 +234,10 @@ The query identifies stores that aren't high-volume.
233234
"isNotHighVolume": false,
234235
"storeCategory": "Small/Medium Store"
235236
}
237+
]
236238
```
237239

238240
## Related content
239241

240242
[!INCLUDE[Related content](../includes/related-content.md)]
243+

articles/cosmos-db/mongodb/vcore/operators/logical-query/$or.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The `$or` operator performs a logical OR operation on an array of expressions an
3636

3737
## Examples
3838

39-
Let's understand the usage with sample json from `stores` dataset.
39+
Consider this sample document from the stores collection.
4040

4141
```json
4242
{
@@ -150,7 +150,7 @@ Let's understand the usage with sample json from `stores` dataset.
150150

151151
### Example 1: Use OR operation as logical-query
152152

153-
The example helps to find stores with more than 15 full-time staff or more than 20 part-time staff, run a query using the $or operator on both the conditions. Then, project only the name and staff fields from the stores in the result set.
153+
This query retrieves stores with more than 15 full-time staff or more than 20 part-time staff, run a query using the $or operator on both the conditions. Then, project only the name and staff fields from the stores in the result set.
154154

155155
```javascript
156156
db.stores.find(
@@ -167,9 +167,10 @@ db.stores.find(
167167
).limit(2)
168168
```
169169

170-
The query returns up to two store documents showing only their name and staff details, filtered by employee count criteria.
170+
The first two results returned by this query are:
171171

172172
```json
173+
[
173174
{
174175
"_id": "dda2a7d2-6984-40cc-bbea-4cbfbc06d8a3",
175176
"name": "Contoso, Ltd. | Home Improvement Closet - Jaskolskiview",
@@ -190,11 +191,12 @@ The query returns up to two store documents showing only their name and staff de
190191
}
191192
}
192193
}
194+
]
193195
```
194196

195197
### Example 2: Use OR operator as boolean-expression to identify stores with either high sales or large staff
196198

197-
The example finds stores that have either total sales greater than 50,000 or more than 25 total staff members.
199+
This query retrieves stores that have either total sales greater than 50,000 or more than 25 total staff members.
198200

199201
```javascript
200202
db.stores.aggregate([
@@ -217,9 +219,10 @@ db.stores.aggregate([
217219
])
218220
```
219221

220-
The query returns stores that meet either the sales or staffing criteria.
222+
The first four results returned by this query are:
221223

222224
```json
225+
[
223226
{
224227
"_id": "905d1939-e03a-413e-a9c4-221f74055aac",
225228
"name": "Trey Research | Home Office Depot - Lake Freeda",
@@ -244,6 +247,7 @@ The query returns stores that meet either the sales or staffing criteria.
244247
"totalStaff": 2,
245248
"qualifiesForProgram": false
246249
}
250+
]
247251
```
248252

249253
## Performance Considerations
@@ -258,3 +262,4 @@ The query returns stores that meet either the sales or staffing criteria.
258262
## Related content
259263

260264
[!INCLUDE[Related content](../includes/related-content.md)]
265+

0 commit comments

Comments
 (0)