Skip to content

Commit fe906f9

Browse files
committed
Rewrite around id created automatically.
1 parent b647bf4 commit fe906f9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,16 @@ Create an index using the [update collection extension command](/azure/cosmos-db
182182
183183
Create a document with the *product* properties for the `adventureworks` database:
184184
185-
* An _id property for the unique identifier of the product.
186185
* A *category* property. This property can be used as the logical partition key.
187186
* A *name* property.
188187
* An inventory *quantity* property.
189188
* A *sale* property, indicating whether the product is on sale.
190189
191190
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="new_doc":::
192191
193-
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.
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 in case you run this sample code more than once.
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.
194195
195196
### Get a document
196197
@@ -202,7 +203,7 @@ In Azure Cosmos DB, you can perform a less-expensive [point read](https://devblo
202203
203204
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.
204205
205-
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="query_doc":::
206+
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="query_docs":::
206207
207208
Troubleshooting:
208209

0 commit comments

Comments
 (0)