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.
2
Answers
As per the Microsoft Documentation it says,
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.