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
Copy file name to clipboardExpand all lines: articles/cosmos-db/nosql/quickstart-java.md
+24-18Lines changed: 24 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,19 +230,22 @@ You can authenticate to Cosmos DB for NoSQL using `DefaultAzureCredential` by ad
230
230
231
231
* 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.
232
232
233
-
```azurecli
233
+
```azurecli-interactive
234
234
# 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 \
238
238
--name AzureSampleFamilyDB
239
+
```
239
240
241
+
```azurecli-interactive
240
242
# 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'
246
249
```
247
250
248
251
* Item creation by using the `createItem` method.
@@ -310,19 +313,22 @@ You can authenticate to Cosmos DB for NoSQL using `DefaultAzureCredential` by ad
310
313
311
314
* 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.
312
315
313
-
```azurecli
316
+
```azurecli-interactive
314
317
# 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 \
318
321
--name AzureSampleFamilyDB
322
+
```
319
323
324
+
```azurecli-interactive
320
325
# 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'
326
332
```
327
333
328
334
* 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