Skip to content

Commit b647bf4

Browse files
committed
Correction to code snippet paths.
1 parent 094bcd3 commit b647bf4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,19 @@ Use the [MongoClient](https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo
164164
165165
Check if the database exists with [list_database_names](https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient.list_database_names) method. If the database doesn't exist, use the [create database extension command](/azure/cosmos-db/mongodb/custom-commands#create-database) to create it with a specified provisioned throughput.
166166
167-
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="new_database" :::
167+
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="new_database":::
168168
169169
### Get collection
170170
171171
Check if the collection exists with the [list_collection_names](https://pymongo.readthedocs.io/en/stable/api/pymongo/database.html#pymongo.database.Database.list_collection_names) method. If the collection doesn't exist, use the [create collection extension command](/azure/cosmos-db/mongodb/custom-commands#create-collection) to create it.
172172
173-
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="new_collection":::
173+
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="create_collection":::
174174
175175
### Create an index
176176
177177
Create an index using the [update collection extension command](/azure/cosmos-db/mongodb/custom-commands#update-collection). You can also set the index in the create collection extension command. Set the index to `name` property in this example so that you can later sort with the cursor class [sort](https://pymongo.readthedocs.io/en/stable/api/pymongo/cursor.html#pymongo.cursor.Cursor.sort) method on product name.
178178
179-
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/index.js" id="create_index":::
179+
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="create_index":::
180180
181181
### Create a document
182182
@@ -188,21 +188,21 @@ Create a document with the *product* properties for the `adventureworks` databas
188188
* An inventory *quantity* property.
189189
* A *sale* property, indicating whether the product is on sale.
190190
191-
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/index.js" id="new_doc":::
191+
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="new_doc":::
192192
193193
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, we chose to *upsert* instead of *create* a new document in case you run this sample code more than once.
194194
195195
### Get a document
196196
197197
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 partition key (`category`).
198198
199-
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/index.js" id="read_doc":::
199+
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="read_doc":::
200200
201201
### Query documents
202202
203203
After you insert a doc, you can run a query to get all docs that match a specific filter. This example finds all docs that match a specific category: `gear-surf-surfboards`. Once the query is defined, call [`Collection.find`](https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html#pymongo.collection.Collection.find) to get a [`Cursor`](https://pymongo.readthedocs.io/en/stable/api/pymongo/cursor.html#pymongo.cursor.Cursor) result.
204204
205-
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/index.js" id="query_doc":::
205+
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="query_doc":::
206206
207207
Troubleshooting:
208208
@@ -220,7 +220,7 @@ python run.py
220220

221221
The output of the app should be similar to this example:
222222

223-
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/index.js" id="console_result":::
223+
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="console_result":::
224224

225225
## Clean up resources
226226

0 commit comments

Comments
 (0)