Skip to content

Commit bea0ed3

Browse files
authored
Revise $and operator documentation with updated examples
Updated examples and descriptions for clarity and accuracy.
1 parent fbf2e44 commit bea0ed3

File tree

1 file changed

+8
-6
lines changed
  • articles/cosmos-db/mongodb/vcore/operators/logical-query

1 file changed

+8
-6
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

0 commit comments

Comments
 (0)