Skip to content

Commit f678dde

Browse files
authored
Update quickstart-go.md
1 parent 561af00 commit f678dde

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The following snippets are all taken from the `todo.go` file.
6969
7070
### Connecting the Go app to Azure Cosmos DB
7171
72-
[`clientOptions`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo/options?tab=doc#ClientOptions) encapsulates the connection string for Azure Cosmos DB, which is passed in using an environment variable (details in the upcoming section). The connection is initialized using [`mongo.NewClient`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo?tab=doc#NewClient) to which the `clientOptions` instance is passed. [`Ping` function](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo?tab=doc#Client.Ping) is invoked to confirm successful connectivity (it is a fail-fast strategy)
72+
[`clientOptions`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo/options?tab=doc#ClientOptions) encapsulates the connection string for Azure Cosmos DB, which is passed in using an environment variable (details in the upcoming section). The connection is initialized using [`mongo.NewClient`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo?tab=doc#NewClient) to which the `clientOptions` instance is passed. [`Ping` function](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo?tab=doc#Client.Ping) is invoked to confirm successful connectivity (it is a fail-fast strategy).
7373
7474
```go
7575
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
@@ -109,7 +109,7 @@ func create(desc string) {
109109
}
110110
```
111111
112-
We pass in a `Todo` struct that contains the description and the status (which is initially set to `pending`)
112+
We pass in a `Todo` struct that contains the description and the status (which is initially set to `pending`):
113113
114114
```go
115115
type Todo struct {
@@ -120,7 +120,7 @@ type Todo struct {
120120
```
121121
### List `todo` items
122122
123-
We can list TODOs based on criteria. A [`bson.D`](https://pkg.go.dev/go.mongodb.org/[email protected]/bson?tab=doc#D) is created to encapsulate the filter criteria
123+
We can list TODOs based on criteria. A [`bson.D`](https://pkg.go.dev/go.mongodb.org/[email protected]/bson?tab=doc#D) is created to encapsulate the filter criteria:
124124
125125
```go
126126
func list(status string) {
@@ -153,7 +153,7 @@ func list(status string) {
153153
}
154154
```
155155
156-
Finally, the information is rendered in tabular format
156+
Finally, the information is rendered in tabular format:
157157
158158
```go
159159
todoTable := [][]string{}
@@ -174,7 +174,7 @@ Finally, the information is rendered in tabular format
174174
175175
### Update a `todo` item
176176
177-
A `todo` can be updated based on its `_id`. A [`bson.D`](https://pkg.go.dev/go.mongodb.org/[email protected]/bson?tab=doc#D) filter is created based on the `_id` and another one is created for the updated information, which is a new status (`completed` or `pending`) in this case. Finally, the [`UpdateOne`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo?tab=doc#Collection.UpdateOne) function is invoked with the filter and the updated document
177+
A `todo` can be updated based on its `_id`. A [`bson.D`](https://pkg.go.dev/go.mongodb.org/[email protected]/bson?tab=doc#D) filter is created based on the `_id` and another one is created for the updated information, which is a new status (`completed` or `pending`) in this case. Finally, the [`UpdateOne`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo?tab=doc#Collection.UpdateOne) function is invoked with the filter and the updated document:
178178
179179
```go
180180
func update(todoid, newStatus string) {
@@ -247,11 +247,11 @@ If `cosmosdb` is not in the list of base commands, reinstall [Azure CLI](/cli/az
247247
248248
### Create a resource group
249249
250-
Create a [resource group](../../azure-resource-manager/management/overview.md) with the [az group create](/cli/azure/group#az-group-create). An Azure resource group is a logical container into which Azure resources like web apps, databases and storage accounts are deployed and managed.
250+
Create a [resource group](../../azure-resource-manager/management/overview.md) with the [az group create](/cli/azure/group#az-group-create). An Azure resource group is a logical container into which Azure resources like web apps, databases, and storage accounts are deployed and managed.
251251
252252
The following example creates a resource group in the West Europe region. Choose a unique name for the resource group.
253253
254-
If you are using Azure Cloud Shell, select **Try It**, follow the onscreen prompts to login, then copy the command into the command prompt.
254+
If you are using Azure Cloud Shell, select **Try It**, follow the onscreen prompts to log in, then copy the command into the command prompt.
255255
256256
```azurecli-interactive
257257
az group create --name myResourceGroup --location "West Europe"
@@ -323,7 +323,7 @@ The Azure CLI outputs information similar to the following example.
323323
## Configure the application
324324
325325
<a name="devconfig"></a>
326-
### Export the connection string, MongoDB database and collection names as environment variables.
326+
### Export the connection string, MongoDB database, and collection names as environment variables.
327327
328328
```bash
329329
export MONGODB_CONNECTION_STRING="mongodb://<COSMOSDB_ACCOUNT_NAME>:<COSMOSDB_PASSWORD>@<COSMOSDB_ACCOUNT_NAME>.documents.azure.com:10255/?ssl=true&replicaSet=globaldb&maxIdleTimeMS=120000&appName=@<COSMOSDB_ACCOUNT_NAME>@"
@@ -371,7 +371,7 @@ List all the `todo`s
371371
./todo --list all
372372
```
373373
374-
You should see the ones you just added in a tabular format as such
374+
You should see the ones you just added in a tabular format as such:
375375
376376
```bash
377377
+----------------------------+--------------------------------+-----------+
@@ -384,7 +384,7 @@ You should see the ones you just added in a tabular format as such
384384
+----------------------------+--------------------------------+-----------+
385385
```
386386
387-
To update the status of a `todo` (e.g. change it to `completed` status), use the `todo` ID
387+
To update the status of a `todo` (e.g. change it to `completed` status), use the `todo` ID:
388388
389389
```bash
390390
./todo --update 5e9fd6b1bcd2fa6bd267d4c4,completed
@@ -396,7 +396,7 @@ List only the completed `todo`s
396396
./todo --list completed
397397
```
398398
399-
You should see the one you just updated
399+
You should see the one you just updated:
400400
401401
```bash
402402
+----------------------------+--------------------------------+-----------+
@@ -418,19 +418,19 @@ In the top Search box, enter **Azure Cosmos DB**. When your Azure Cosmos DB acco
418418
:::image type="content" source="./media/quickstart-go/go-cosmos-db-data-explorer.png" alt-text="Data Explorer showing the newly created document":::
419419
420420
421-
Delete a `todo` using it's ID
421+
Delete a `todo` using its ID:
422422
423423
```bash
424424
./todo --delete 5e9fd6b1bcd2fa6bd267d4c4,completed
425425
```
426426
427-
List the `todo`s to confirm
427+
List the `todo`s to confirm:
428428
429429
```bash
430430
./todo --list all
431431
```
432432
433-
The `todo` you just deleted should not be present
433+
The `todo` you just deleted should not be present:
434434
435435
```bash
436436
+----------------------------+--------------------------------+-----------+

0 commit comments

Comments
 (0)