Skip to content

Commit 9c4cb62

Browse files
author
Theo van Kraay
committed
add interactive cli commands
1 parent 4d0a5c2 commit 9c4cb62

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

articles/cosmos-db/nosql/quickstart-java.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,22 @@ You can authenticate to Cosmos DB for NoSQL using `DefaultAzureCredential` by ad
230230

231231
* Use the [`az cosmosdb sql database create`](/cli/azure/cosmosdb/sql/database#az-cosmosdb-sql-database-create) and [`az cosmosdb sql container create`](/cli/azure/cosmosdb/sql/container#az-cosmosdb-sql-container-create) commands to create a Cosmos DB NoSQL database and container.
232232

233-
```azurecli
233+
```azurecli-interactive
234234
# Create a SQL API database
235-
az cosmosdb sql database create
236-
--account-name msdocs-cosmos-nosql
237-
--resource-group msdocs
235+
az cosmosdb sql database create \
236+
--account-name msdocs-cosmos-nosql \
237+
--resource-group msdocs \
238238
--name AzureSampleFamilyDB
239+
```
239240

241+
```azurecli-interactive
240242
# Create a SQL API container
241-
az cosmosdb sql container create
242-
--account-name msdocs-cosmos-nosql
243-
--resource-group msdocs
244-
--database-name cosmicworks
245-
--name FamilyContainer
243+
az cosmosdb sql container create \
244+
--account-name msdocs-cosmos-nosql \
245+
--resource-group msdocs \
246+
--database-name AzureSampleFamilyDB \
247+
--name FamilyContainer \
248+
--partition-key-path '/lastName'
246249
```
247250

248251
* Item creation by using the `createItem` method.
@@ -310,19 +313,22 @@ You can authenticate to Cosmos DB for NoSQL using `DefaultAzureCredential` by ad
310313

311314
* Use the [`az cosmosdb sql database create`](/cli/azure/cosmosdb/sql/database#az-cosmosdb-sql-database-create) and [`az cosmosdb sql container create`](/cli/azure/cosmosdb/sql/container#az-cosmosdb-sql-container-create) commands to create a Cosmos DB NoSQL database and container.
312315

313-
```azurecli
316+
```azurecli-interactive
314317
# Create a SQL API database
315-
az cosmosdb sql database create
316-
--account-name msdocs-cosmos-nosql
317-
--resource-group msdocs
318+
az cosmosdb sql database create \
319+
--account-name msdocs-cosmos-nosql \
320+
--resource-group msdocs \
318321
--name AzureSampleFamilyDB
322+
```
319323

324+
```azurecli-interactive
320325
# Create a SQL API container
321-
az cosmosdb sql container create
322-
--account-name msdocs-cosmos-nosql
323-
--resource-group msdocs
324-
--database-name cosmicworks
325-
--name FamilyContainer
326+
az cosmosdb sql container create \
327+
--account-name msdocs-cosmos-nosql \
328+
--resource-group msdocs \
329+
--database-name AzureSampleFamilyDB \
330+
--name FamilyContainer \
331+
--partition-key-path '/lastName'
326332
```
327333

328334
* As with the sync API, item creation is accomplished using the `createItem` method. This example shows how to efficiently issue numerous async `createItem` requests by subscribing to a Reactive Stream which issues the requests and prints notifications. Since this simple example runs to completion and terminates, `CountDownLatch` instances are used to ensure the program does not terminate during item creation. **The proper asynchronous programming practice is not to block on async calls - in realistic use-cases requests are generated from a main() loop that executes indefinitely, eliminating the need to latch on async calls.**

0 commit comments

Comments
 (0)