Skip to content

Commit 67e32ad

Browse files
authored
Merge pull request #278308 from seesharprun/cosmos-nosql-quickstarts-repo-hyperlink
Cosmos DB | Add GitHub hyperlinks to NoSQL Quickstarts
2 parents 5822b4b + b8d84c5 commit 67e32ad

File tree

13 files changed

+457
-170
lines changed

13 files changed

+457
-170
lines changed

articles/cosmos-db/mongodb/includes/dev-setup.md

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
author: seesharprun
3+
ms.author: sidandrews
4+
ms.service: cosmos-db
5+
ms.subservice: mongodb
6+
ms.topic: include
7+
ms.date: 06/14/2024
8+
ms.custom: include file
9+
zone_pivot_groups: azure-cosmos-db-quickstart-env
10+
---
11+
12+
::: zone pivot="devcontainer-codespace"
13+
14+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
15+
- [GitHub account](https://docs.github.com//get-started/quickstart/creating-an-account-on-github)
16+
17+
::: zone-end
18+
19+
::: zone pivot="devcontainer-vscode"
20+
21+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
22+
- [Azure Developer CLI](/azure/developer/azure-developer-cli/install-azd)
23+
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)
24+
25+
::: zone-end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
author: seesharprun
3+
ms.author: sidandrews
4+
ms.service: cosmos-db
5+
ms.subservice: mongodb
6+
ms.topic: include
7+
ms.date: 06/14/2024
8+
ms.custom: include file
9+
---
10+
11+
> [!div class="op_single_selector"]
12+
>
13+
> - [Node.js](../quickstart-nodejs.md)
14+
> - [Python](../quickstart-python.md)
15+
> - [Java](../quickstart-java.md)
16+
> - [.NET](../quickstart-dotnet.md)
17+
> - [Golang](../quickstart-go.md)
18+
>

articles/cosmos-db/mongodb/quickstart-dotnet.md

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: cosmos-db
77
ms.subservice: mongodb
88
ms.devlang: csharp
99
ms.topic: quickstart
10-
ms.date: 07/06/2022
10+
ms.date: 06/14/2024
1111
ms.custom: devx-track-csharp, mode-api, devguide-csharp, cosmos-db-dev-journey, devx-track-dotnet, devx-track-extended-azdevcli
1212
zone_pivot_groups: azure-cosmos-db-quickstart-env
1313
---
@@ -16,14 +16,16 @@ zone_pivot_groups: azure-cosmos-db-quickstart-env
1616

1717
[!INCLUDE[MongoDB](~/reusable-content/ce-skilling/azure/includes/cosmos-db/includes/appliesto-mongodb.md)]
1818

19+
[!INCLUDE[Developer Quickstart selector](includes/quickstart-dev-selector.md)]
20+
1921
Get started with MongoDB to create databases, collections, and docs within your Azure Cosmos DB resource. Follow these steps to deploy a minimal solution to your environment using the Azure Developer CLI.
2022

2123
[API for MongoDB reference documentation](https://www.mongodb.com/docs/drivers/csharp) | [MongoDB Package (NuGet)](https://www.nuget.org/packages/MongoDB.Driver)
2224
packages/Microsoft.Azure.Cosmos) | [Azure Developer CLI](/azure/developer/azure-developer-cli/overview)
2325

2426
## Prerequisites
2527

26-
[!INCLUDE [Developer Quickstart prerequisites](../nosql/includes/quickstart/dev-prereqs.md)]
28+
[!INCLUDE [Developer Quickstart prerequisites](includes/quickstart-dev-prereqs.md)]
2729

2830
## Setting up
2931

@@ -41,7 +43,61 @@ Deploy this project's development container to your environment. Then, use the A
4143

4244
::: zone-end
4345

44-
[!INCLUDE [dev-setup](../nosql/includes/quickstart/dev-setup.md)]
46+
::: zone pivot="devcontainer-codespace"
47+
48+
> [!IMPORTANT]
49+
> GitHub accounts include an entitlement of storage and core hours at no cost. For more information, see [included storage and core hours for GitHub accounts](https://docs.github.com/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#monthly-included-storage-and-core-hours-for-personal-accounts).
50+
51+
::: zone-end
52+
53+
::: zone pivot="devcontainer-vscode"
54+
55+
::: zone-end
56+
57+
1. Open a terminal in the root directory of the project.
58+
59+
1. Authenticate to the Azure Developer CLI using `azd auth login`. Follow the steps specified by the tool to authenticate to the CLI using your preferred Azure credentials.
60+
61+
```azurecli
62+
azd auth login
63+
```
64+
65+
1. Use `azd init` to initialize the project.
66+
67+
```azurecli
68+
azd init --template cosmos-db-mongodb-dotnet-quickstart
69+
```
70+
71+
> [!NOTE]
72+
> This quickstart uses the [azure-samples/cosmos-db-mongodb-dotnet-quickstart](https://github.com/azure-samples/cosmos-db-mongodb-dotnet-quickstart) template GitHub repository. The Azure Developer CLI will automatically clone this project to your machine if it is not already there.
73+
74+
1. During initialization, configure a unique environment name.
75+
76+
> [!TIP]
77+
> The environment name will also be used as the target resource group name. For this quickstart, consider using `msdocs-cosmos-db`.
78+
79+
1. Deploy the Azure Cosmos DB account using `azd up`. The Bicep templates also deploy a sample web application.
80+
81+
```azurecli
82+
azd up
83+
```
84+
85+
1. During the provisioning process, select your subscription and desired location. Wait for the provisioning process to complete. The process can take **approximately five minutes**.
86+
87+
1. Once the provisioning of your Azure resources is done, a URL to the running web application is included in the output.
88+
89+
```output
90+
Deploying services (azd deploy)
91+
92+
(✓) Done: Deploying service web
93+
- Endpoint: <https://[container-app-sub-domain].azurecontainerapps.io>
94+
95+
SUCCESS: Your application was provisioned and deployed to Azure in 5 minutes 0 seconds.
96+
```
97+
98+
1. Use the URL in the console to navigate to your web application in the browser. Observe the output of the running app.
99+
100+
:::image type="content" source="media/quickstart/dev-web-application.png" alt-text="Screenshot of the running web application.":::
45101
46102
---
47103
@@ -75,11 +131,11 @@ Before you start building the application, let's look into the hierarchy of reso
75131
Hierarchical diagram showing an Azure Cosmos DB account at the top. The account has two child database shards. One of the database shards includes two child collection shards. The other database shard includes a single child collection shard. That single collection shard has three child doc shards.
76132
:::image-end:::
77133
78-
You'll use the following MongoDB classes to interact with these resources:
134+
You use the following MongoDB classes to interact with these resources:
79135
80136
- [``MongoClient``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/T_MongoDB_Driver_MongoClient.htm) - This class provides a client-side logical representation for the API for MongoDB layer on Azure Cosmos DB. The client object is used to configure and execute requests against the service.
81-
- [``MongoDatabase``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/T_MongoDB_Driver_MongoDatabase.htm) - This class is a reference to a database that may, or may not, exist in the service yet. The database is validated server-side when you attempt to access it or perform an operation against it.
82-
- [``Collection``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/T_MongoDB_Driver_MongoCollection.htm) - This class is a reference to a collection that also may not exist in the service yet. The collection is validated server-side when you attempt to work with it.
137+
- [``MongoDatabase``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/T_MongoDB_Driver_MongoDatabase.htm) - This class is a reference to a database that might, or might not, exist in the service yet. The database is validated server-side when you attempt to access it or perform an operation against it.
138+
- [``Collection``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/T_MongoDB_Driver_MongoCollection.htm) - This class is a reference to a collection that also might not exist in the service yet. The collection is validated server-side when you attempt to work with it.
83139
84140
## Code examples
85141
@@ -104,13 +160,13 @@ Define a new instance of the ``MongoClient`` class using the constructor, and [`
104160
105161
### Create a database
106162
107-
Use the [``MongoClient.GetDatabase``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/M_MongoDB_Driver_MongoClient_GetDatabase.htm) method to create a new database if it doesn't already exist. This method will return a reference to the existing or newly created database.
163+
Use the [``MongoClient.GetDatabase``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/M_MongoDB_Driver_MongoClient_GetDatabase.htm) method to create a new database if it doesn't already exist. This method returns a reference to the existing or newly created database.
108164
109165
:::code language="csharp" source="~/azure-cosmos-mongodb-dotnet/001-quickstart/Program.cs" id="new_database" :::
110166
111167
### Create a collection
112168
113-
The [``MongoDatabase.GetCollection``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/M_MongoDB_Driver_MongoDatabase_GetCollection.htm) will create a new collection if it doesn't already exist and return a reference to the collection.
169+
The [``MongoDatabase.GetCollection``](https://mongodb.github.io/mongo-csharp-driver/2.16/apidocs/html/M_MongoDB_Driver_MongoDatabase_GetCollection.htm) creates a new collection if it doesn't already exist and return a reference to the collection.
114170
115171
:::code language="csharp" source="~/azure-cosmos-mongodb-dotnet/001-quickstart/Program.cs" id="new_collection":::
116172
@@ -146,7 +202,7 @@ After you insert an item, you can run a query to get all items that match a spec
146202

147203
## Run the code
148204

149-
This app creates an Azure Cosmos DB MongoDb API database and collection. The example then creates an item and then reads the exact same item back. Finally, the example creates a second item and then performs a query that should return multiple items. With each step, the example outputs metadata to the console about the steps it has performed.
205+
This app creates an Azure Cosmos DB MongoDb API database and collection. The example then creates an item and then reads the exact same item back. Finally, the example creates a second item and then performs a query that should return multiple items. With each step, the example outputs metadata to the console about the performed steps.
150206

151207
To run the app, use a terminal to navigate to the application directory and run the application.
152208

@@ -195,10 +251,10 @@ Remove-AzResourceGroup @parameters
195251
> In this quickstart, we recommended the name ``msdocs-cosmos-quickstart-rg``.
196252
1. Select **Delete resource group**.
197253

198-
:::image type="content" source="media/quickstart-dotnet/delete-resource-group-option.png" lightbox="media/quickstart-dotnet/delete-resource-group-option.png" alt-text="Screenshot of the Delete resource group option in the navigation bar for a resource group.":::
254+
:::image type="content" source="media/quickstart-dotnet/delete-resource-group-option.png" lightbox="media/quickstart-dotnet/delete-resource-group-option.png" alt-text="Screenshot of the 'Delete resource group' option in the navigation bar for a resource group.":::
199255

200256
1. On the **Are you sure you want to delete** dialog, enter the name of the resource group, and then select **Delete**.
201257

202-
:::image type="content" source="media/quickstart-dotnet/delete-confirmation.png" lightbox="media/quickstart-dotnet/delete-confirmation.png" alt-text="Screenshot of the delete confirmation page for a resource group.":::
258+
:::image type="content" source="media/quickstart-dotnet/delete-confirmation.png" lightbox="media/quickstart-dotnet/delete-confirmation.png" alt-text="Screenshot of the deletion confirmation dialog for a resource group.":::
203259

204260
---

0 commit comments

Comments
 (0)