Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the mongodb connection string on a Azure Cosmos DB provisioned with a Graph API?

I saw that CosmosDB can be accessed via any supported api regardless of whether it's set up as a GraphDB first. https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb-introduction I see the example where I can run a SQL query against the graph database - but how do I get the MongoDB api connection string for it?

Since it was set up as a graphdb api from the start, the mongo db connection strings don't appear in the settings like so: https://learn.microsoft.com/en-us/azure/cosmos-db/connect-mongodb-account#GetCustomConnection

Instead I only see the keys settings.

like image 931
MonkeyBonkey Avatar asked Sep 20 '25 20:09

MonkeyBonkey


1 Answers

So it looks like all I have to do is use the primary key as the password and use the same uri with ssl as the endpoint.

e.g. mongodb://[myInstanceName]:[primaryAccountKey]@[myInstanceName].documents.azure.com:10255/?ssl=true

I left out &replicaSet=globaldb because I was getting errors with that..

like image 184
MonkeyBonkey Avatar answered Sep 23 '25 11:09

MonkeyBonkey