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/mongodb/includes/environment-variables-connection-string.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ ms.topic: include
7
7
ms.date: 06/13/2019
8
8
ms.author: diberry
9
9
---
10
-
To use the **CONNECTION STRING** values within your code, set this value on the local machine running the application. To set the environment variable, use your preferred terminal to run the following commands:
10
+
To use the **CONNECTION STRING** values within your code, set this value in the local environment running the application. To set the environment variable, use your preferred terminal to run the following commands:
Copy file name to clipboardExpand all lines: articles/cosmos-db/mongodb/quickstart-python.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,9 +77,9 @@ This quickstart will create a single Azure Cosmos DB account using the API for M
77
77
1. Create a new empty folder using your preferred terminal and change directory to the folder.
78
78
79
79
> [!NOTE]
80
-
> If you just want the finished code, download or fork and clone the [example code snippets](https://github.com/Azure-Samples/azure-cosmos-db-mongodb-python-getting-started)from GitHub that has the full example. You can also `git clone` the repo in Azure Cloud Shell to try out the code.
80
+
> If you just want the finished code, download or fork and clone the [example code snippets](https://github.com/Azure-Samples/azure-cosmos-db-mongodb-python-getting-started)repo that has the full example. You can also `git clone` the repo in Azure Cloud Shell to walk through the steps shown in this quickstart.
81
81
82
-
2. Create a *requirements.txt* file with lines for the [PyMongo](https://www.mongodb.com/docs/drivers/pymongo/) and the[python-dotenv](https://pypi.org/project/python-dotenv/) packages.
82
+
2. Create a *requirements.txt* file that lists the [PyMongo](https://www.mongodb.com/docs/drivers/pymongo/) and [python-dotenv](https://pypi.org/project/python-dotenv/) packages.
83
83
84
84
```text
85
85
# requirements.txt
@@ -136,9 +136,9 @@ To learn more about the hierarchy of entities, see the [Azure Cosmos DB resource
136
136
* [Get an document](#get-a-document)
137
137
* [Query documents](#query-documents)
138
138
139
-
The sample code described in this article creates a database named `adventureworks` with a collection named `products`. The `products` collection is designed to contain product details such as name, category, quantity, and a sale indicator. Each product also contains a unique identifier. The complete sample code is at https://github.com/Azure-Samples/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/.
139
+
The sample code described in this article creates a database named `adventureworks` with a collection named `products`. The `products` collection is designed to contain product details such as name, category, quantity, and a sale indicator. Each product also contains a unique identifier. The complete sample code is at https://github.com/Azure-Samples/azure-cosmos-db-mongodb-python-getting-started/tree/main/001-quickstart/.
140
140
141
-
For the steps below, the database won't use sharding and shows a synchronous application using PyMongo. For asynchronous applications, use the [Motor](https://www.mongodb.com/docs/drivers/motor/) driver.
141
+
For the steps below, the database won't use sharding and shows a synchronous application using the [PyMongo](https://www.mongodb.com/docs/drivers/pymongo/) driver. For asynchronous applications, use the [Motor](https://www.mongodb.com/docs/drivers/motor/) driver.
142
142
143
143
### Authenticate the client
144
144
@@ -189,17 +189,17 @@ Create a document with the *product* properties for the `adventureworks` databas
Create a document in the collection by calling the collection level operation [update_one](https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html#pymongo.collection.Collection.update_one). In this example, you'll *upsert* instead of *create* a new documentin case you run this sample code more than once.
192
+
Create a document in the collection by calling the collection level operation [update_one](https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html#pymongo.collection.Collection.update_one). In this example, you'll *upsert* instead of *create* a new document. Upsert isn't necessary in this example because the product *name* is random. However, it's a good practice to upsert in case you run the code more than once and the product name is the same.
193
193
194
-
The result of the `update_one` operation contains the `_id` field value that you can use in subsequent operations. The *_id* property was created automatically in this case.
194
+
The result of the `update_one` operation contains the `_id` field value that you can use in subsequent operations. The *_id* property was created automatically.
195
195
196
196
### Get a document
197
197
198
198
Use the [find_one](https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html#pymongo.collection.Collection.find_one) method to get a document.
In Azure Cosmos DB, you can perform a less-expensive [point read](https://devblogs.microsoft.com/cosmosdb/point-reads-versus-queries/) operation by using both the unique identifier (`_id`) and a partition key. In this code quickstart, you could use `category`.
202
+
In Azure Cosmos DB, you can perform a less-expensive [point read](https://devblogs.microsoft.com/cosmosdb/point-reads-versus-queries/) operation by using both the unique identifier (`_id`) and a partition key.
203
203
204
204
### Query documents
205
205
@@ -213,7 +213,7 @@ Troubleshooting:
213
213
214
214
## Run the code
215
215
216
-
This app creates an API for MongoDB database and collection and creates a document and then reads the exact same document back. Finally, the example issues a query that should only return that single doc. With each step, the example outputs information to the console about the steps it has performed.
216
+
This app creates an API for MongoDB database and collection and creates a document and then reads the exact same document back. Finally, the example issues a query that returns documents that match a specified product *category*. With each step, the example outputs information to the console about the steps it has performed.
217
217
218
218
To run the app, use a terminal to navigate to the application directory and run the application.
0 commit comments