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
Use [queries](#query-for-documents) and [aggregation pipelines](#aggregation-pipelines)to find and manipulate documents in a collection.
19
19
20
20
> [!NOTE]
21
21
> The [example code snippets](https://github.com/Azure-Samples/cosmos-db-mongodb-api-javascript-samples) are available on GitHub as a JavaScript project.
@@ -37,6 +37,131 @@ The preceding code snippet displays the following example console output:
Aggregation pipelines are useful to isolate expensive query computation, transformations, and other processing on your Cosmos DB server, instead of performing these operations on the client.
43
+
44
+
For specific **aggregation pipeline support**, refer to the following:
Use a pipeline to keep data processing on the server before returning to the client.
107
+
108
+
### Example product data
109
+
110
+
The aggregations below use the [sample products collection](https://github.com/Azure-Samples/cosmos-db-mongodb-api-javascript-samples/blob/main/252-insert-many/products.json) with data in the shape of:
"description": "The product called \"HL Touring Seat/Saddle\"",
143
+
"price": 52.640000000000001,
144
+
"tags": [
145
+
]
146
+
},
147
+
]
148
+
```
149
+
150
+
### Example 1: Product subcategories, count of products, and average price
151
+
152
+
Use the following [sample code](https://github.com/Azure-Samples/cosmos-db-mongodb-api-javascript-samples/blob/main/280-aggregation/average-price-in-each-product-subcategory.js) to report on average price in each product subcategory.
Use the following [sample code](https://github.com/Azure-Samples/cosmos-db-mongodb-api-javascript-samples/blob/main/280-aggregation/bike-types-and-price-ranges.js) to report on the `Bikes` subcategory.
0 commit comments