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/gremlin/quickstart-console.md
+3-6Lines changed: 3 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ In this quickstart, you use the Gremlin console to connect to a newly created Az
28
28
- No Azure subscription? [Sign up for a free Azure account](https://azure.microsoft.com/free/).
29
29
- Don't want an Azure subscription? You can [try Azure Cosmos DB free](../try-free.md) with no subscription required.
30
30
-[Docker host](https://www.docker.com/)
31
-
- Don't have Docker installed? Try this quickstart in a devcontainer. [](https://codespaces.new/github/codespaces-blank?quickstart=1)
31
+
- Don't have Docker installed? Try this quickstart in [GitHub Codespaces](https://codespaces.new/github/codespaces-blank?quickstart=1).
Copy file name to clipboardExpand all lines: articles/cosmos-db/gremlin/quickstart-dotnet.md
+13-24Lines changed: 13 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ In this quickstart, you use the `Gremlin.Net` library to connect to a newly crea
30
30
- No Azure subscription? [Sign up for a free Azure account](https://azure.microsoft.com/free/).
31
31
- Don't want an Azure subscription? You can [try Azure Cosmos DB free](../try-free.md) with no subscription required.
32
32
-[.NET (LTS)](https://dotnet.microsoft.com/)
33
-
- Don't have .NET installed? Try this quickstart in a devcontainer. [](https://codespaces.new/github/codespaces-blank?quickstart=1)
33
+
- Don't have .NET installed? Try this quickstart in [GitHub Codespaces](https://codespaces.new/github/codespaces-blank?quickstart=1).
@@ -87,7 +87,7 @@ Add the `Gremlin.NET` NuGet package to the .NET project.
87
87
88
88
### Configure environment variables
89
89
90
-
To use the *NAME* and *URI* values obtained earlier in this quickstart, persist them to new environment variables on the local machine running the application.
90
+
To use the *NAME* and *URI* values obtained earlier in this quickstart, persist them to new environment variables on the local machine running the application.
91
91
92
92
1. To set the environment variable, use your terminal to persist the values as `COSMOS_ENDPOINT` and `COSMOS_KEY` respectively.
93
93
@@ -130,11 +130,11 @@ Application requests to most Azure services must be authorized. For the API for
130
130
131
131
1. Create a new instance of `GremlinServer` using the account's credentials.
1. Write to the console the static string `[CREATED PRODUCT]\t68719518403`.
202
+
1. Write to the console the static string `[CREATED PRODUCT]\t68719518403`. Then, iterate over each matching vertex using a `foreach` loop and write to the console a message that starts with `[REPLACES PRODUCT]` and includes the matching product `id` field as a suffix.
1. Iterate over each matching vertex using a `foreach` loop and write to the console a message that starts with `[REPLACES PRODUCT]` and includes the matching product `id` field as a suffix.
Copy file name to clipboardExpand all lines: articles/cosmos-db/gremlin/quickstart-nodejs.md
+161-1Lines changed: 161 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ In this quickstart, you use the `gremlin` library to connect to a newly created
30
30
- No Azure subscription? [Sign up for a free Azure account](https://azure.microsoft.com/free/).
31
31
- Don't want an Azure subscription? You can [try Azure Cosmos DB free](../try-free.md) with no subscription required.
32
32
-[Node.js (LTS)](https://nodejs.org/)
33
-
- Don't have Node.js installed? Try this quickstart in a devcontainer. [](https://codespaces.new/github/codespaces-blank?quickstart=1)
33
+
- Don't have Node.js installed? Try this quickstart in [GitHub Codespaces](https://codespaces.new/github/codespaces-blank?quickstart=1).codespaces.new/github/codespaces-blank?quickstart=1)
@@ -45,11 +45,171 @@ The API for Gremlin account should be created prior to using the Node.js library
45
45
46
46
[!INCLUDE[Create account, database, and graph](includes/create-account-database-graph-cli.md)]
47
47
48
+
### Create a new Node.js console application
48
49
50
+
Create a Node.js console application in an empty folder using your preferred terminal.
49
51
52
+
1. Open your terminal in an empty folder.
50
53
54
+
1. Initialize a new module
51
55
56
+
```bash
57
+
npm init es6 --yes
58
+
```
52
59
60
+
1. Create the **app.js** file
61
+
62
+
```bash
63
+
touch app.js
64
+
```
65
+
66
+
### Install the npm package
67
+
68
+
Add the `gremlin` npm package to the Node.js project.
69
+
70
+
1. Open the **package.json** file and replace the contents with this JSON configuration.
71
+
72
+
```json
73
+
{
74
+
"main": "app.js",
75
+
"type": "module",
76
+
"scripts": {
77
+
"start": "node app.js"
78
+
},
79
+
"dependencies": {
80
+
"gremlin": "^3.*"
81
+
}
82
+
}
83
+
```
84
+
85
+
1. Use the `npm install`command to install all packages specified in the **package.json** file.
86
+
87
+
```bash
88
+
npm install
89
+
```
90
+
91
+
### Configure environment variables
92
+
93
+
To use the *NAME* and *URI* values obtained earlier in this quickstart, persist them to new environment variables on the local machine running the application.
94
+
95
+
1. To set the environment variable, use your terminal to persist the values as `COSMOS_ENDPOINT` and `COSMOS_KEY` respectively.
96
+
97
+
```bash
98
+
export COSMOS_GREMLIN_ENDPOINT="<account-name>"
99
+
export COSMOS_GREMLIN_KEY="<account-key>"
100
+
```
101
+
102
+
1. Validate that the environment variables were set correctly.
103
+
104
+
```bash
105
+
printenv COSMOS_GREMLIN_ENDPOINT
106
+
printenv COSMOS_GREMLIN_KEY
107
+
```
108
+
109
+
## Code examples
110
+
111
+
- [Authenticate the client](#authenticate-the-client)
112
+
- [Create vertices](#create-vertices)
113
+
- [Create edges](#create-edges)
114
+
- [Query vertices & edges](#query-vertices--edges)
115
+
116
+
The code in this article connects to a database named `cosmicworks` and a graph named `products`. The code then adds vertices and edges to the graph before traversing the added items.
117
+
118
+
### Authenticate the client
119
+
120
+
Application requests to most Azure services must be authorized. For the API forGremlin, use the *NAME* and *URI* values obtained earlierin this quickstart.
121
+
122
+
1. Open the **app.js** file.
123
+
124
+
1. Import the `gremlin` module.
125
+
126
+
```javascript
127
+
import gremlin from 'gremlin'
128
+
```
129
+
130
+
1. Create `accountName` and `accountKey` string variables. Store the `COSMOS_GREMLIN_ENDPOINT` and `COSMOS_GREMLIN_KEY` environment variables as the values for each respective variable.
131
+
132
+
```javascript
133
+
134
+
```
135
+
136
+
1. Use `PlainTextSaslAuthenticator` to create a new object for the account's credentials.
137
+
138
+
```javascript
139
+
140
+
```
141
+
142
+
1. Use `Client` to connect using the remote server credentials and the **GraphSON 2.0** serializer.
143
+
144
+
```javascript
145
+
146
+
```
147
+
148
+
1. TODO
149
+
150
+
```javascript
151
+
152
+
```
153
+
154
+
1. TODO
155
+
156
+
```javascript
157
+
158
+
```
159
+
160
+
1. TODO
161
+
162
+
```javascript
163
+
164
+
```
165
+
166
+
1. TODO
167
+
168
+
```javascript
169
+
170
+
```
171
+
172
+
1. TODO
173
+
174
+
```javascript
175
+
176
+
```
177
+
178
+
1. TODO
179
+
180
+
```javascript
181
+
182
+
```
183
+
184
+
1. TODO
185
+
186
+
```javascript
187
+
188
+
```
189
+
190
+
1. TODO
191
+
192
+
```javascript
193
+
194
+
```
195
+
196
+
1. TODO
197
+
198
+
```javascript
199
+
200
+
```
201
+
202
+
1. TODO
203
+
204
+
```javascript
205
+
206
+
```
207
+
208
+
## Clean up resources
209
+
210
+
When you no longer need the API for Gremlin account, delete the corresponding resource group.
Copy file name to clipboardExpand all lines: articles/cosmos-db/gremlin/quickstart-python.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ In this quickstart, you use the `gremlinpython` library to connect to a newly cr
30
30
- No Azure subscription? [Sign up for a free Azure account](https://azure.microsoft.com/free/).
31
31
- Don't want an Azure subscription? You can [try Azure Cosmos DB free](../try-free.md) with no subscription required.
32
32
-[Python (latest)](https://www.python.org/)
33
-
- Don't have Python installed? Try this quickstart in a devcontainer. [](https://codespaces.new/github/codespaces-blank?quickstart=1)
33
+
- Don't have Python installed? Try this quickstart in [GitHub Codespaces](https://codespaces.new/github/codespaces-blank?quickstart=1).
0 commit comments