Skip to content

Commit 1bd00ef

Browse files
Merge pull request #230248 from JustPies/jprefresh-3-9-2
Freshness Pass User Story: 2036619 Connect a MongoDB application to Azure Cosmos DB
2 parents 26ccc29 + 21f8bd7 commit 1bd00ef

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed
Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,84 @@
11
---
22
title: Connect a MongoDB application to Azure Cosmos DB
3-
description: Learn how to connect a MongoDB app to Azure Cosmos DB by getting the connection string from Azure portal
3+
description: Learn how to connect a MongoDB app to Azure Cosmos DB by getting the connection string from Azure portal.
44
author: gahl-levy
55
ms.author: gahllevy
66
ms.service: cosmos-db
77
ms.subservice: mongodb
88
ms.custom: ignite-2022
99
ms.topic: how-to
10-
ms.date: 08/26/2021
10+
ms.date: 03/14/2023
1111
ms.reviewer: mjbrown
1212
adobe-target: true
1313
adobe-target-activity: DocsExp-A/B-384740-MongoDB-2.8.2021
1414
adobe-target-experience: Experience B
1515
adobe-target-content: ./connect-mongodb-account-experimental
1616
---
17+
1718
# Connect a MongoDB application to Azure Cosmos DB
19+
1820
[!INCLUDE[MongoDB](../includes/appliesto-mongodb.md)]
1921

2022
Learn how to connect your MongoDB app to an Azure Cosmos DB by using a MongoDB connection string. You can then use an Azure Cosmos DB database as the data store for your MongoDB app.
2123

2224
This tutorial provides two ways to retrieve connection string information:
2325

24-
- [The quickstart method](#get-the-mongodb-connection-string-by-using-the-quick-start), for use with .NET, Node.js, MongoDB Shell, Java, and Python drivers
25-
- [The custom connection string method](#get-the-mongodb-connection-string-to-customize), for use with other drivers
26+
* [The quickstart method](#get-the-mongodb-connection-string-by-using-the-quick-start), for use with .NET, Node.js, MongoDB Shell, Java, and Python drivers.
27+
* [The custom connection string method](#get-the-mongodb-connection-string-to-customize), for use with other drivers.
2628

2729
## Prerequisites
2830

29-
- An Azure account. If you don't have an Azure account, create a [free Azure account](https://azure.microsoft.com/free/) now.
30-
- An Azure Cosmos DB account. For instructions, see [Build a web app using Azure Cosmos DB's API for MongoDB and .NET SDK](create-mongodb-dotnet.md).
31+
* An Azure account. If you don't have an Azure account, create a [free Azure account](https://azure.microsoft.com/free/) now.
32+
* An Azure Cosmos DB account. For instructions, see [Quickstart: Azure Cosmos DB for MongoDB driver for Node.js](create-mongodb-dotnet.md).
3133

3234
## Get the MongoDB connection string by using the quick start
3335

3436
1. In an Internet browser, sign in to the [Azure portal](https://portal.azure.com).
35-
2. In the **Azure Cosmos DB** blade, select the API.
36-
3. In the left pane of the account blade, click **Quick start**.
37-
4. Choose your platform (**.NET**, **Node.js**, **MongoDB Shell**, **Java**, **Python**). If you don't see your driver or tool listed, don't worry--we continuously document more connection code snippets. Please comment below on what you'd like to see. To learn how to craft your own connection, read [Get the account's connection string information](#get-the-mongodb-connection-string-to-customize).
38-
5. Copy and paste the code snippet into your MongoDB app.
37+
1. In the **Azure Cosmos DB** pane, select the API.
38+
1. In the left pane of the account pane, select **Quick start**.
39+
1. Choose your platform (**.NET**, **Node.js**, **MongoDB Shell**, **Java**, **Python**). If you don't see your driver or tool listed, don't worry--we continuously document more connection code snippets. Comment on what you'd like to see. To learn how to craft your own connection, read [Get the account's connection string information](#get-the-mongodb-connection-string-to-customize).
40+
1. Copy and paste the code snippet into your MongoDB app.
3941

40-
:::image type="content" source="./media/connect-account/quickstart-blade.png" alt-text="Quick start blade":::
42+
:::image type="content" source="./media/connect-account/quickstart-pane.png" alt-text="Screenshot showing the Quick start pane.":::
4143

4244
## Get the MongoDB connection string to customize
4345

4446
1. In an Internet browser, sign in to the [Azure portal](https://portal.azure.com).
45-
2. In the **Azure Cosmos DB** blade, select the API.
46-
3. In the left pane of the account blade, click **Connection String**.
47-
4. The **Connection String** blade opens. It has all the information necessary to connect to the account by using a driver for MongoDB, including a preconstructed connection string.
47+
1. In the **Azure Cosmos DB** pane, select the API.
48+
1. In the left pane of the account pane, select **Connection strings**.
49+
1. The **Connection strings** pane opens. It has all the information necessary to connect to the account by using a driver for MongoDB, including a preconstructed connection string.
4850

49-
:::image type="content" source="./media/connect-account/connection-string-blade.png" alt-text="Connection String blade" lightbox= "./media/connect-account/connection-string-blade.png" :::
51+
:::image type="content" source="./media/connect-account/connection-string-pane.png" alt-text="Screenshot showing the Connection strings pane." lightbox="./media/connect-account/connection-string-pane.png" :::
5052

5153
## Connection string requirements
5254

53-
> [!Important]
55+
> [!IMPORTANT]
5456
> Azure Cosmos DB has strict security requirements and standards. Azure Cosmos DB accounts require authentication and secure communication via *TLS*.
5557
56-
Azure Cosmos DB supports the standard MongoDB connection string URI format, with a couple of specific requirements: Azure Cosmos DB accounts require authentication and secure communication via TLS. So, the connection string format is:
58+
Azure Cosmos DB supports the standard MongoDB connection string URI format, with a couple of specific requirements: Azure Cosmos DB accounts require authentication and secure communication via TLS. The connection string format is:
5759

5860
`mongodb://username:password@host:port/[database]?ssl=true`
5961

60-
The values of this string are available in the **Connection String** blade shown earlier:
62+
The values of this string are:
6163

6264
* Username (required): Azure Cosmos DB account name.
6365
* Password (required): Azure Cosmos DB account password.
6466
* Host (required): FQDN of the Azure Cosmos DB account.
6567
* Port (required): 10255.
6668
* Database (optional): The database that the connection uses. If no database is provided, the default database is "test."
67-
* ssl=true (required)
69+
* ssl=true (required).
6870

69-
For example, consider the account shown in the **Connection String** blade. A valid connection string is:
71+
For example, consider the account shown in the **Connection strings** pane. A valid connection string is:
7072

7173
`mongodb://contoso123:0Fc3IolnL12312asdfawejunASDF@asdfYXX2t8a97kghVcUzcDv98hawelufhawefafnoQRGwNj2nMPL1Y9qsIr9Srdw==@contoso123.documents.azure.com:10255/mydatabase?ssl=true`
7274

7375
## Driver Requirements
7476

75-
All drivers that support wire protocol version 3.4 or greater will support Azure Cosmos DB for MongoDB.
77+
All drivers that support wire protocol version 3.4 or greater support Azure Cosmos DB for MongoDB.
7678

7779
Specifically, client drivers must support the Service Name Identification (SNI) TLS extension and/or the appName connection string option. If the `appName` parameter is provided, it must be included as found in the connection string value in the Azure portal.
7880

7981
## Next steps
8082

81-
- Learn how to [use Studio 3T](connect-using-mongochef.md) with Azure Cosmos DB's API for MongoDB.
82-
- Learn how to [use Robo 3T](connect-using-robomongo.md) with Azure Cosmos DB's API for MongoDB.
83-
- Explore MongoDB [samples](nodejs-console-app.md) with Azure Cosmos DB's API for MongoDB.
84-
- Trying to do capacity planning for a migration to Azure Cosmos DB? You can use information about your existing database cluster for capacity planning.
85-
- If all you know is the number of vcores and servers in your existing database cluster, read about [estimating request units using vCores or vCPUs](../convert-vcore-to-request-unit.md)
86-
- If you know typical request rates for your current database workload, read about [estimating request units using Azure Cosmos DB capacity planner](estimate-ru-capacity-planner.md)
83+
* [Connect to an Azure Cosmos DB account using Studio 3T](connect-using-mongochef.md).
84+
* [Use Robo 3T with Azure Cosmos DB's API for MongoDB](connect-using-robomongo.md)
Binary file not shown.
153 KB
Loading
Binary file not shown.
186 KB
Loading

0 commit comments

Comments
 (0)