Skip to content

Commit b105a81

Browse files
authored
Update $or operator documentation
1 parent 440d465 commit b105a81

File tree

1 file changed

+10
-5
lines changed
  • articles/cosmos-db/mongodb/vcore/operators/logical-query

1 file changed

+10
-5
lines changed

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)