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
@@ -68,7 +68,7 @@ This step is optional. If you're interested in learning how the application work
68
68
69
69
The following snippets are all taken from the `todo.go` file.
70
70
71
-
### Connecting the Go app to Cosmos DB
71
+
### Connecting the Go app to Azure Cosmos DB
72
72
73
73
[`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)
74
74
@@ -94,7 +94,7 @@ The following snippets are all taken from the `todo.go` file.
94
94
> Using the [`SetDirect(true)`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo/options?tab=doc#ClientOptions.SetDirect) configuration is important, without which you will get the following connectivity error: `unable to connect connection(cdb-ms-prod-<azure-region>-cm1.documents.azure.com:10255[-4]) connection is closed`
95
95
>
96
96
97
-
### Create a `todo`
97
+
### Create a `todo` item
98
98
99
99
To create a `todo`, we get a handle to a [`mongo.Collection`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo?tab=doc#Collection) and invoke the [`InsertOne`](https://pkg.go.dev/go.mongodb.org/[email protected]/mongo?tab=doc#Collection.InsertOne) function.
100
100
@@ -120,7 +120,7 @@ type Todo struct {
120
120
Status string `bson:"status"`
121
121
}
122
122
```
123
-
### List `todo`s
123
+
### List `todo` items
124
124
125
125
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
126
126
@@ -174,7 +174,7 @@ Finally, the information is rendered in tabular format
174
174
table.Render()
175
175
```
176
176
177
-
### Update a `todo`
177
+
### Update a `todo` item
178
178
179
179
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
180
180
@@ -417,7 +417,7 @@ To view, query, and work with the user data created in the previous step, login
417
417
418
418
In the top Search box, enter **Azure Cosmos DB**. When your Cosmos account blade opens, select your Cosmos account. In the left navigation, select **Data Explorer**. Expand your collection in the Collections pane, and then you can view the documents in the collection, query the data, and even create and run stored procedures, triggers, and UDFs.
419
419
420
-

420
+

0 commit comments