Skip to content

Commit 23b6624

Browse files
committed
Add more code samples from repo and change pub config.
1 parent 8a09b8a commit 23b6624

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,12 @@
883883
"url": "https://github.com/MicrosoftDocs/reusable-content",
884884
"branch": "main",
885885
"branch_mapping": {}
886+
},
887+
{
888+
"path_to_root": "azure-cosmos-db-mongodb-python-getting-started",
889+
"url": "https://github.com/Azure-Samples/azure-cosmos-db-mongodb-python-getting-started",
890+
"branch": "main",
891+
"branch_mapping": {}
886892
}
887893
],
888894
"branch_target_mapping": {

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

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.service: cosmos-db
88
ms.subservice: mongodb
99
ms.devlang: python
1010
ms.topic: quickstart
11-
ms.date: 10/31/2022
11+
ms.date: 11/08/2022
1212
ms.custom: devx-track-js, ignite-2022
1313
---
1414

@@ -158,30 +158,13 @@ For the steps below, the database won't use sharding and shows a synchronous app
158158
159159
Use the [MongoClient](https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient) object to connect to your Azure Cosmos DB for MongoDB resource. The connect method returns a reference to the database.
160160
161-
```python
162-
client = pymongo.MongoClient(CONNECTION_STRING)
163-
```
164-
<!---
165161
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="connect_client":::
166-
--->
167162
168163
### Get database
169164
170165
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.
171166
172-
```python
173-
# Create database if it doesn't exist
174-
db = client[DB_NAME]
175-
if DB_NAME not in client.list_database_names():
176-
# Database with 400 RU throughput that can be shared across the DB's collections
177-
db.command({"customAction": "CreateDatabase", "offerThroughput": 400})
178-
print("Created db '{}' with shared throughput.\n".format(DB_NAME))
179-
else:
180-
print("Using database: '{}'.\n".format(DB_NAME))
181-
```
182-
<!---
183167
:::code language="python" source="~/azure-cosmos-db-mongodb-python-getting-started/001-quickstart/run.py" id="new_database" :::
184-
--->
185168
186169
### Get collection
187170

0 commit comments

Comments
 (0)