Skip to content

Commit 2416324

Browse files
committed
Revamp quickstart for azd and codespaces
1 parent 5279cdd commit 2416324

File tree

1 file changed

+12
-46
lines changed

1 file changed

+12
-46
lines changed

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

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ms.devlang: javascript
99
ms.topic: quickstart
1010
ms.date: 07/06/2022
1111
ms.custom: devx-track-js, devguide-js, cosmos-db-dev-journey, devx-track-azurecli
12+
zone_pivot_groups: azure-cosmos-db-quickstart-env
1213
---
1314

1415
# Quickstart: Azure Cosmos DB for MongoDB driver for Node.js
@@ -26,68 +27,33 @@ ms.custom: devx-track-js, devguide-js, cosmos-db-dev-journey, devx-track-azurecl
2627
2728
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.
2829

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

3433
## Prerequisites
3534

36-
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free).
37-
- [Node.js LTS](https://nodejs.org/en/download/)
38-
- [Azure Command-Line Interface (CLI)](/cli/azure/) or [Azure PowerShell](/powershell/azure/)
39-
40-
### Prerequisite check
41-
42-
- In a terminal or command window, run ``node --version`` to check that Node.js is one of the LTS versions.
43-
- Run ``az --version`` (Azure CLI) or ``Get-Module -ListAvailable AzureRM`` (Azure PowerShell) to check that you have the appropriate Azure command-line tools installed.
35+
[!INCLUDE [Developer Quickstart prerequisites](../nosql/includes/quickstart/dev-prereqs.md)]
4436

4537
## Setting up
4638

47-
This section walks you through creating an Azure Cosmos DB account and setting up a project that uses the MongoDB npm package.
48-
49-
### Create an Azure Cosmos DB account
50-
51-
This quickstart will create a single Azure Cosmos DB account using the API for MongoDB.
52-
53-
#### [Azure CLI](#tab/azure-cli)
54-
55-
[!INCLUDE [Azure CLI - create resources](./includes/azure-cli-create-resource-group-and-resource.md)]
56-
57-
#### [PowerShell](#tab/azure-powershell)
58-
59-
[!INCLUDE [Powershell - create resource group and resources](./includes/powershell-create-resource-group-and-resource.md)]
39+
Deploy this project's development container to your environment. Then, use the Azure Developer CLI (`azd`) to create an Azure Cosmos DB for MongoDB account and deploy a containerized sample application. The sample application uses the client library to manage, create, read, and query sample data.
6040

61-
#### [Portal](#tab/azure-portal)
41+
::: zone pivot="devcontainer-codespace"
6242

63-
[!INCLUDE [Portal - create resource](./includes/portal-create-resource.md)]
43+
[![Open in GitHub Codespaces](https://img.shields.io/static/v1?style=for-the-badge&label=GitHub+Codespaces&message=Open&color=brightgreen&logo=github)](https://codespaces.new/alexwolfmsft/cosmos-db-mongodb-nodejs-quickstart?template=false&quickstart=1&azure-portal=true)
6444

65-
---
66-
67-
### Get MongoDB connection string
68-
69-
#### [Azure CLI](#tab/azure-cli)
45+
::: zone-end
7046

71-
[!INCLUDE [Azure CLI - get connection string](./includes/azure-cli-get-connection-string.md)]
47+
::: zone pivot="devcontainer-vscode"
7248

73-
#### [PowerShell](#tab/azure-powershell)
49+
[![Open in Dev Container](https://img.shields.io/static/v1?style=for-the-badge&label=Dev+Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/alexwolfmsft/cosmos-db-mongodb-nodejs-quickstart)
7450

75-
[!INCLUDE [Powershell - get connection string](./includes/powershell-get-connection-string.md)]
51+
::: zone-end
7652

77-
#### [Portal](#tab/azure-portal)
78-
79-
[!INCLUDE [Portal - get connection string](./includes/portal-get-connection-string-from-resource.md)]
53+
[!INCLUDE [dev-setup](../nosql/includes/quickstart/dev-setup.md)]
8054

8155
---
8256

83-
### Create a new JavaScript app
84-
85-
Create a new JavaScript application in an empty folder using your preferred terminal. Use the [``npm init``](https://docs.npmjs.com/cli/v8/commands/npm-init) command to begin the prompts to create the `package.json` file. Accept the defaults for the prompts.
86-
87-
```console
88-
npm init
89-
```
90-
9157
### Install the package
9258

9359
Add the [MongoDB](https://www.npmjs.com/package/mongodb) npm package to the JavaScript project. Use the [``npm install package``](https://docs.npmjs.com/cli/v8/commands/npm-install) command specifying the name of the npm package. The `dotenv` package is used to read the environment variables from a `.env` file during local development.

0 commit comments

Comments
 (0)