简体   繁体   English

通过Graph API设置的Azure Cosmos DB上的mongodb连接字符串是什么?

[英]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. 我看到CosmosDB可以通过任何受支持的api进行访问,而不管它是否首先设置为GraphDB。 https://docs.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? https://docs.microsoft.com/zh-cn/azure/cosmos-db/mongodb-introduction我看到了可以对图形数据库运行SQL查询的示例-但是如何获得MongoDB api连接字符串它?

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://docs.microsoft.com/en-us/azure/cosmos-db/connect-mongodb-account#GetCustomConnection 由于从一开始就将其设置为graphdb api,因此mongo db连接字符串不会出现在以下设置中: https : //docs.microsoft.com/zh-cn/azure/cosmos-db/connect- mongodb-account#GetCustomConnection

Instead I only see the keys settings. 相反,我只看到按键设置。

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. 因此,看来我要做的就是使用主键作为密码,并使用与ssl相同的uri作为端点。

eg mongodb://[myInstanceName]:[primaryAccountKey]@[myInstanceName].documents.azure.com:10255/?ssl=true 例如mongodb://[myInstanceName]:[primaryAccountKey]@[myInstanceName].documents.azure.com:10255/?ssl=true

I left out &replicaSet=globaldb because I was getting errors with that.. 我忽略了&replicaSet=globaldb因为我在此方面遇到了错误。

Currently the APIs in Cosmos DB are not all inter-operable, meaning if you created Gremlin API account, you can't reliably access the data in it with MongoDB API and vice-versa. 当前,Cosmos DB中的API并非都可以互操作,这意味着如果创建了Gremlin API帐户,则无法使用MongoDB API可靠地访问其中的数据,反之亦然。 You can always create separate MongoDB API account in order to be able to read-write data reliably. 您始终可以创建单独的MongoDB API帐户,以便能够可靠地读写数据。 You will also get the MongoDB connection string right in the portal settings. 您还将在门户网站设置中获得MongoDB连接字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM