Home > database >  Azure Cosmos Mongo API version 3.6 but cannot connect with mongo.cosmos.azure.com:443
Azure Cosmos Mongo API version 3.6 but cannot connect with mongo.cosmos.azure.com:443

Time:06-09

I'm trying to connect to a Java application for change feed.

new CosmosClientBuilder().endpoint(ENDPOINT).key(KEY).buildAsyncClient();

The server version is 3.6 but when I try to give ENDPOINT as https://myproject.mongo.cosmos.azure.com:443 it is not working, getting error. But when I give it like https://myproject.documents.azure.com:443 it's getting connected. Anyone has any idea why it's like this?

From the Resource JSON I can see documentEndpoint as https://myproject.documents.azure.com:443 and mongoEndpoint as https://myproject.mongo.cosmos.azure.com:443

I'm using primary password as the KEY.

CodePudding user response:

As per the Microsoft Documentation it says,

For new accounts, the Azure Cosmos DB MongoDB API is compatible with MongoDB server version 3.6 by default.

  • The supported operators and any limitations or exceptions are listed below. Any client driver that supports these protocols should be able to connect to the Azure Cosmos DB MongoDB API.
  • Note that when using Azure Cosmos DB's API for MongoDB accounts, the 3.6 version of account has the endpoint in the format
    *.mongo.cosmos.azure.com whereas the 3.2 version of account has the endpoint in the format *.documents.azure.com.

CodePudding user response:

Port 443 is incorrect. Not sure why the Azure Portal shows that port on the Overview tab but it is incorrect.

To connect to a Mongo API account use port 10255 instead of 443.

Best thing to do is go to the Connection String tab and copy the connection string on that page. It has the full connection string for connecting to your Mongo API account.

  • Related