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/create-sql-api-nodejs.md
+16-17Lines changed: 16 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
-
title: 'Quickstart: Build a Node.js app to connect and manage data in Azure Cosmos DB SQL API account'
3
-
description: Learn to build a Node.js app to connect, query, and manage data in Azure Cosmos DB SQL API account
2
+
title: 'Quickstart: Use Node.js to query from Azure Cosmos DB SQL API account'
3
+
description: How to use Node.js to create an app that connects to Azure Cosmos DB SQL API account and queries data.
4
4
author: deborahc
5
5
ms.service: cosmos-db
6
6
ms.subservice: cosmosdb-sql
7
7
ms.devlang: nodejs
8
8
ms.topic: quickstart
9
-
ms.date: 05/21/2019
9
+
ms.date: 11/19/2019
10
10
ms.author: dech
11
11
12
12
---
13
-
# Quickstart: Build a Node.js app to connect to Azure Cosmos DB SQL API account and manage data
13
+
# Quickstart: Use Node.js to connect and query data from Azure Cosmos DB SQL API account
14
14
15
15
> [!div class="op_single_selector"]
16
16
> *[.NET V3](create-sql-api-dotnet.md)
@@ -20,9 +20,7 @@ ms.author: dech
20
20
> *[Python](create-sql-api-python.md)
21
21
> *[Xamarin](create-sql-api-xamarin-dotnet.md)
22
22
23
-
Azure Cosmos DB is Microsoft’s globally distributed multi-model database service. You can quickly create and query document, key/value, and graph databases, all of which benefit from the global distribution and horizontal scale capabilities at the core of Azure Cosmos DB.
24
-
25
-
This quickstart demonstrates how to create an Azure Cosmos DB [SQL API](sql-api-introduction.md) account, document database, and container using the Azure portal. You then build and run a console app built on the [SQL JavaScript SDK](sql-api-sdk-node.md). This quickstart uses version 2.0 of the [JavaScript SDK](https://www.npmjs.com/package/@azure/cosmos).
23
+
This quickstart demonstrates how to use a Node.js app to connect to the [SQL API](sql-api-introduction.md) account in Azure Cosmos DB. You can then use Azure Cosmos DB SQL queries to query and manage data. The Node.js app you build in this article uses the [SQL JavaScript SDK](sql-api-sdk-node.md). This quickstart uses version 2.0 of the [JavaScript SDK](https://www.npmjs.com/package/@azure/cosmos).
26
24
27
25
## Prerequisites
28
26
@@ -33,7 +31,7 @@ This quickstart demonstrates how to create an Azure Cosmos DB [SQL API](sql-api-
33
31
* [Node.js](https://nodejs.org/en/) version v6.0.0 or higher
@@ -51,7 +49,7 @@ This quickstart demonstrates how to create an Azure Cosmos DB [SQL API](sql-api-
51
49
52
50
## Clone the sample application
53
51
54
-
Now let's clone a SQL API app from GitHub, set the connection string, and run it.
52
+
Now let's clone a Node.js app from GitHub, set the connection string, and run it.
55
53
56
54
1. Open a command prompt, create a new folder named git-samples, then close the command prompt.
57
55
@@ -73,25 +71,25 @@ Now let's clone a SQL API app from GitHub, set the connection string, and run it
73
71
74
72
## Review the code
75
73
76
-
This step is optional. If you're interested in learning how the database resources are created in the code, you can review the following snippets. Otherwise, you can skip ahead to [Update your connection string](#update-your-connection-string).
74
+
This step is optional. If you're interested in learning how the Azure Cosmos database resources are created in the code, you can review the following snippets. Otherwise, you can skip ahead to [Update your connection string](#update-your-connection-string).
77
75
78
76
Note, if you are familiar with the previous version of the JavaScript SDK, you may be used to seeing the terms 'collection' and 'document.' Because Azure Cosmos DB supports [multiple API models](https://docs.microsoft.com/azure/cosmos-db/introduction), version 2.0+ of the JavaScript SDK uses the generic terms 'container', which may be a collection, graph, or table and 'item' to describe the content of the container.
79
77
80
78
The following snippets are all taken from the **app.js** file.
81
79
82
-
* The `CosmosClient` is initialized.
80
+
* The `CosmosClient` object is initialized.
83
81
84
82
```javascript
85
83
const client = new CosmosClient({ endpoint, key });
* A SQL query over JSON is performed on the family database. The query returns all the children of the "Anderson" family.
107
105
108
106
```javascript
109
107
const querySpec = {
@@ -129,7 +127,7 @@ The following snippets are all taken from the **app.js** file.
129
127
130
128
## Update your connection string
131
129
132
-
Now go back to the Azure portal to get your connection string information. Copy the connection string into the app so that it can connect to your Azure Cosmos account.
130
+
Now go back to the Azure portal to get the connection string details of your Azure Cosmos account. Copy the connection string into the app so that it can connect to your database.
133
131
134
132
1. In the [Azure portal](https://portal.azure.com/), in your Azure Cosmos account, in the left navigation click **Keys**, and then click **Read-write Keys**. You'll use the copy buttons on the right side of the screen to copy the URI and Primary Key into the `config.js` file in the next step.
135
133
@@ -146,11 +144,12 @@ Now go back to the Azure portal to get your connection string information. Copy
146
144
`config.key = "FILLME"`
147
145
148
146
## Run the app
147
+
149
148
1. Run `npm install` in a terminal to install required npm modules
150
149
151
150
2. Run `node app.js` in a terminal to start your node application.
152
151
153
-
You can now go back to Data Explorer and see query, modify, and work with this new data.
152
+
You can now go back to Data Explorer, modify, and work with this new data.
154
153
155
154
## Review SLAs in the Azure portal
156
155
@@ -162,7 +161,7 @@ You can now go back to Data Explorer and see query, modify, and work with this n
162
161
163
162
## Next steps
164
163
165
-
In this quickstart, you've learned how to create an Azure Cosmos account, create a container using the Data Explorer, and run an app. You can now import additional data to your Cosmos DB account.
164
+
In this quickstart, you've learned how to create an Azure Cosmos account, create a container using the data explorer, and run an app. You can now import additional data to your Azure Cosmos database.
166
165
167
166
> [!div class="nextstepaction"]
168
167
> [Import data into Azure Cosmos DB](import-data.md)
0 commit comments