Skip to content

Commit f827f8c

Browse files
committed
Add Quickstart dev selector
1 parent 1dbc53f commit f827f8c

File tree

3 files changed

+44
-34
lines changed

3 files changed

+44
-34
lines changed
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: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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](../nosql/includes/quickstart-dev-prereqs.md)]
2729

2830
## Setting up
2931

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

4244
::: zone-end
4345

44-
[!INCLUDE[Developer Quickstart setup prefix](includes/quickstart/dev-setup-prefix.md)]
46+
[!INCLUDE[Developer Quickstart setup prefix](includes/quickstart-dev-setup-prefix.md)]
4547

4648
1. Use `azd init` to initialize the project.
4749

@@ -52,7 +54,7 @@ Deploy this project's development container to your environment. Then, use the A
5254
> [!NOTE]
5355
> 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.
5456
55-
[!INCLUDE[Developer Quickstart setup prefix](includes/quickstart/dev-setup-suffix.md)]
57+
[!INCLUDE[Developer Quickstart setup prefix](includes/quickstart-dev-setup-suffix.md)]
5658
5759
---
5860
@@ -86,11 +88,11 @@ Before you start building the application, let's look into the hierarchy of reso
8688
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.
8789
:::image-end:::
8890
89-
You'll use the following MongoDB classes to interact with these resources:
91+
You use the following MongoDB classes to interact with these resources:
9092
9193
- [``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.
92-
- [``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.
93-
- [``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.
94+
- [``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.
95+
- [``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.
9496
9597
## Code examples
9698
@@ -115,13 +117,13 @@ Define a new instance of the ``MongoClient`` class using the constructor, and [`
115117
116118
### Create a database
117119
118-
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.
120+
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.
119121
120122
:::code language="csharp" source="~/azure-cosmos-mongodb-dotnet/001-quickstart/Program.cs" id="new_database" :::
121123
122124
### Create a collection
123125
124-
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.
126+
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.
125127
126128
:::code language="csharp" source="~/azure-cosmos-mongodb-dotnet/001-quickstart/Program.cs" id="new_collection":::
127129
@@ -157,7 +159,7 @@ After you insert an item, you can run a query to get all items that match a spec
157159

158160
## Run the code
159161

160-
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.
162+
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.
161163

162164
To run the app, use a terminal to navigate to the application directory and run the application.
163165

@@ -206,10 +208,10 @@ Remove-AzResourceGroup @parameters
206208
> In this quickstart, we recommended the name ``msdocs-cosmos-quickstart-rg``.
207209
1. Select **Delete resource group**.
208210

209-
:::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.":::
211+
:::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.":::
210212

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

213-
:::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.":::
215+
:::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.":::
214216

215217
---

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

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +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-
> [!div class="op_single_selector"]
20-
>
21-
> * [.NET](quickstart-dotnet.md)
22-
> * [Python](quickstart-python.md)
23-
> * [Java](quickstart-java.md)
24-
> * [Node.js](quickstart-nodejs.md)
25-
> * [Go](quickstart-go.md)
26-
>
19+
[!INCLUDE[Developer Quickstart selector](includes/quickstart-dev-selector.md)]
2720

2821
Get started with the MongoDB npm package to create databases, collections, and docs within your Azure Cosmos DB resource. Follow these steps to install the package and try out example code for basic tasks.
2922

30-
> [!NOTE]
31-
> The [example code snippets](https://github.com/Azure-Samples/cosmos-db-mongodb-nodejs-quickstart) are available on GitHub as a JavaScript project.
32-
3323
[API for MongoDB reference documentation](https://www.mongodb.com/docs/drivers/csharp) | [MongoDB Package (NuGet)](https://www.nuget.org/packages/MongoDB.Driver)
3424
packages/Microsoft.Azure.Cosmos) | [Azure Developer CLI](/azure/developer/azure-developer-cli/overview)
3525

3626
## Prerequisites
3727

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

4030
## Setting up
4131

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

5444
::: zone-end
5545

56-
[!INCLUDE[Developer Quickstart setup prefix](includes/quickstart/dev-setup-prefix.md)]
46+
[!INCLUDE[Developer Quickstart setup prefix](includes/quickstart-dev-setup-prefix.md)]
5747

5848
1. Use `azd init` to initialize the project.
5949

@@ -64,7 +54,7 @@ Deploy this project's development container to your environment. Then, use the A
6454
> [!NOTE]
6555
> This quickstart uses the [azure-samples/cosmos-db-mongodb-nodejs-quickstart](https://github.com/azure-samples/cosmos-db-mongodb-nodejs-quickstart) template GitHub repository. The Azure Developer CLI will automatically clone this project to your machine if it is not already there.
6656
67-
[!INCLUDE[Developer Quickstart setup prefix](includes/quickstart/dev-setup-suffix.md)]
57+
[!INCLUDE[Developer Quickstart setup prefix](includes/quickstart-dev-setup-suffix.md)]
6858
6959
---
7060
@@ -84,26 +74,26 @@ Before you start building the application, let's look into the hierarchy of reso
8474
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 node. That single collection shard has three child doc shards.
8575
:::image-end:::
8676

87-
You'll use the following MongoDB classes to interact with these resources:
77+
You use the following MongoDB classes to interact with these resources:
8878

8979
- [``MongoClient``](https://mongodb.github.io/node-mongodb-native/4.5/classes/MongoClient.html) - 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.
90-
- [``Db``](https://mongodb.github.io/node-mongodb-native/4.5/classes/Db.html) - 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.
91-
- [``Collection``](https://mongodb.github.io/node-mongodb-native/4.5/classes/Collection.html) - 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.
80+
- [``Db``](https://mongodb.github.io/node-mongodb-native/4.5/classes/Db.html) - 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.
81+
- [``Collection``](https://mongodb.github.io/node-mongodb-native/4.5/classes/Collection.html) - 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.
9282

9383
## Code examples
9484

9585
- [Authenticate the client](#authenticate-the-client)
9686
- [Get database instance](#get-database-instance)
9787
- [Get collection instance](#get-collection-instance)
98-
- [Chained instances](#chained-instances)
88+
- [Use chained methods](#chained-instances)
9989
- [Create an index](#create-an-index)
10090
- [Create a doc](#create-a-doc)
10191
- [Get an doc](#get-a-doc)
102-
- [Query docs](#query-docs)
92+
- [Run queries](#query-docs)
10393

10494
The sample code described in this article creates a database named ``adventureworks`` with a collection named ``products``. The ``products`` collection is designed to contain product details such as name, category, quantity, and a sale indicator. Each product also contains a unique identifier.
10595

106-
For this procedure, the database won't use sharding.
96+
For this procedure, the database doesn't use sharding.
10797

10898
### Authenticate the client
10999

@@ -201,7 +191,7 @@ Troubleshooting:
201191

202192
## Run the code
203193

204-
This app creates an API for MongoDB database and collection and creates a doc and then reads the exact same doc back. Finally, the example issues a query that should only return that single doc. With each step, the example outputs information to the console about the steps it has performed.
194+
This app creates an API for MongoDB database and collection and creates a doc and then reads the exact same doc back. Finally, the example issues a query that should only return that single doc. With each step, the example outputs information to the console about the performed steps.
205195

206196
To run the app, use a terminal to navigate to the application directory and run the application.
207197

@@ -244,11 +234,11 @@ Remove-AzResourceGroup @parameters
244234
> In this quickstart, we recommended the name ``msdocs-cosmos-javascript-quickstart-rg``.
245235
1. Select **Delete resource group**.
246236

247-
:::image type="content" source="media/quickstart-nodejs/delete-resource-group-option.png" lightbox="media/quickstart-nodejs/delete-resource-group-option.png" alt-text="Screenshot of the Delete resource group option in the navigation bar for a resource group.":::
237+
:::image type="content" source="media/quickstart-nodejs/delete-resource-group-option.png" lightbox="media/quickstart-nodejs/delete-resource-group-option.png" alt-text="Screenshot of the 'Delete resource group' option in the navigation bar for a resource group.":::
248238

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

251-
:::image type="content" source="media/quickstart-nodejs/delete-confirmation.png" lightbox="media/quickstart-nodejs/delete-confirmation.png" alt-text="Screenshot of the delete confirmation page for a resource group.":::
241+
:::image type="content" source="media/quickstart-nodejs/delete-confirmation.png" lightbox="media/quickstart-nodejs/delete-confirmation.png" alt-text="Screenshot of the deletion confirmation page for a resource group.":::
252242

253243
---
254244

0 commit comments

Comments
 (0)