Skip to content

Commit 059a264

Browse files
authored
Rework cosmicworks section
1 parent d02ed1b commit 059a264

File tree

2 files changed

+46
-37
lines changed

2 files changed

+46
-37
lines changed
-4.66 KB
Loading

articles/cosmos-db/nosql/tutorial-dotnet-web-app.md

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.reviewer: esarroyo
99
ms.service: cosmos-db
1010
ms.subservice: nosql
1111
ms.topic: tutorial
12-
ms.date: 12/02/2022
12+
ms.date: 04/09/2024
1313
ms.devlang: csharp
1414
ms.custom: devx-track-dotnet, cosmos-dev-refresh, cosmos-dev-dotnet-path
1515
---
@@ -50,7 +50,7 @@ First, you'll create a database and container in the existing API for NoSQL acco
5050

5151
:::image type="content" source="media/tutorial-dotnet-web-app/resource-menu-keys.png" lightbox="media/tutorial-dotnet-web-app/resource-menu-keys.png" alt-text="Screenshot of an API for NoSQL account page. The Keys option is highlighted in the resource menu.":::
5252

53-
1. On the **Keys** page, observe and record the value of the **URI**, **PRIMARY KEY**, and **PRIMARY CONNECTION STRING*** fields. These values will be used throughout the tutorial.
53+
1. On the **Keys** page, observe and record the value of the **PRIMARY CONNECTION STRING*** field. This value will be used throughout the tutorial.
5454

5555
:::image type="content" source="media/tutorial-dotnet-web-app/page-keys.png" alt-text="Screenshot of the Keys page with the URI, Primary Key, and Primary Connection String fields highlighted.":::
5656

@@ -70,12 +70,12 @@ First, you'll create a database and container in the existing API for NoSQL acco
7070
| **Database throughput type** | **Manual** |
7171
| **Database throughput amount** | `1000` |
7272
| **Container id** | `products` |
73-
| **Partition key** | `/categoryId` |
73+
| **Partition key** | `/category/name` |
7474

7575
:::image type="content" source="media/tutorial-dotnet-web-app/dialog-new-container.png" alt-text="Screenshot of the New Container dialog in the Data Explorer with various values in each field.":::
7676

7777
> [!IMPORTANT]
78-
> In this tutorial, we will first scale the database up to 4,000 RU/s in shared throughput to maximize performance for the data migration. Once the data migration is complete, we will scale down to 400 RU/s of provisioned throughput.
78+
> In this tutorial, we will first scale the database up to 1,000 RU/s in shared throughput to maximize performance for the data migration. Once the data migration is complete, we will scale down to 400 RU/s of provisioned throughput.
7979
8080
1. Select **OK** to create the database and container.
8181

@@ -84,36 +84,41 @@ First, you'll create a database and container in the existing API for NoSQL acco
8484
> [!TIP]
8585
> You can optionally use the Azure Cloud Shell here.
8686
87-
1. Install a **pre-release**version of the `cosmicworks` dotnet tool from NuGet.
87+
1. Install **v2** of the `cosmicworks` dotnet tool from NuGet.
8888

8989
```bash
90-
dotnet tool install --global cosmicworks --prerelease
90+
dotnet tool install --global cosmicworks --version 2.*
9191
```
9292

9393
1. Use the `cosmicworks` tool to populate your API for NoSQL account with sample product data using the **URI** and **PRIMARY KEY** values you recorded earlier in this lab. Those recorded values will be used for the `endpoint` and `key` parameters respectively.
9494

9595
```bash
9696
cosmicworks \
97-
--datasets product \
98-
--endpoint <uri> \
99-
--key <primary-key>
97+
--number-of-products 1759 \
98+
--number-of-employees 0 \
99+
--disable-hierarchical-partition-keys \
100+
--connection-string <nosql-connection-string>
100101
```
101102

102-
1. Observe the output from the command line tool. It should add more than 200 items to the container. The example output included is truncated for brevity.
103+
1. Observe the output from the command line tool. It should add 1759 items to the container. The example output included is truncated for brevity.
103104

104105
```output
106+
── Parsing connection string ────────────────────────────────────────────────────────────────
107+
╭─Connection string──────────────────────────────────────────────────────────────────────────╮
108+
│ AccountEndpoint=https://<account-name>.documents.azure.com:443/;AccountKey=<account-key>;
109+
╰────────────────────────────────────────────────────────────────────────────────────────────╯
110+
── Populating data ──────────────────────────────────────────────────────────────────────────
111+
╭─Products configuration─────────────────────────────────────────────────────────────────────╮
112+
│ Database cosmicworks │
113+
│ Container products │
114+
│ Count 1,759 │
115+
╰────────────────────────────────────────────────────────────────────────────────────────────╯
105116
...
106-
Revision: v4
107-
Datasets:
108-
product
109-
110-
Database: [cosmicworks] Status: Created
111-
Container: [products] Status: Ready
112-
113-
product Items Count: 295
114-
Entity: [9363838B-2D13-48E8-986D-C9625BE5AB26] Container:products Status: RanToCompletion
115-
...
116-
Container: [product] Status: Populated
117+
[SEED] 00000000-0000-0000-0000-000000005951 | Road-650 Black, 60 - Bikes
118+
[SEED] 00000000-0000-0000-0000-000000005950 | Mountain-100 Silver, 42 - Bikes
119+
[SEED] 00000000-0000-0000-0000-000000005949 | Men's Bib-Shorts, L - Clothing
120+
[SEED] 00000000-0000-0000-0000-000000005948 | ML Mountain Front Wheel - Components
121+
[SEED] 00000000-0000-0000-0000-000000005947 | Mountain-500 Silver, 42 - Bikes
117122
```
118123
119124
1. Return to the **Data Explorer** page for your account.
@@ -173,29 +178,33 @@ First, you'll create a database and container in the existing API for NoSQL acco
173178
174179
```sql
175180
SELECT
176-
p.name,
177-
p.categoryName,
178-
p.tags
181+
p.name,
182+
p.category.name AS category,
183+
p.category.subCategory.name AS subcategory,
184+
p.tags
179185
FROM products p
180-
JOIN t IN p.tags
181-
WHERE t.name = "Tag-32"
186+
JOIN tag IN p.tags
187+
WHERE STRINGEQUALS(tag, "yellow", true)
182188
```
183189
184190
1. The results should be a smaller array of items filtered to only contain items that include at least one tag with a **name** value of `Tag-32`. Again, a subset of the output is included here for brevity.
185191
186192
```output
187-
...
188-
{
189-
"name": "ML Mountain Frame - Black, 44",
190-
"categoryName": "Components, Mountain Frames",
191-
"tags": [
192-
{
193-
"id": "18AC309F-F81C-4234-A752-5DDD2BEAEE83",
194-
"name": "Tag-32"
195-
}
193+
[
194+
...
195+
{
196+
"name": "HL Touring Frame - Yellow, 60",
197+
"category": "Components",
198+
"subcategory": "Touring Frames",
199+
"tags": [
200+
"Components",
201+
"Touring Frames",
202+
"Yellow",
203+
"60"
204+
]
205+
},
206+
...
196207
]
197-
},
198-
...
199208
```
200209
201210
## Create ASP.NET web application

0 commit comments

Comments
 (0)