What is preferred location to the Azure Cosmos DB Emulator?

Purnima Sahu 1 Reputation point
2020-07-30T15:59:21.883+00:00

ConnectionPolicy defaultPolicy = ConnectionPolicy.getDefaultPolicy();
defaultPolicy.setUserAgentSuffix("CosmosDBJavaQuickstart");
defaultPolicy.setPreferredLocations(Lists.newArrayList("_____________________"));

Please help me set preferred location for local emulator of cosmos db.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,434 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Sharma 17,566 Reputation points
    2020-08-03T09:08:47.497+00:00

    Hi @Purnima Sahu , the error you are facing is because of assignment of Preferred location in below line of code.
    defaultPolicy.setPreferredLocations(Lists.newArrayList("_"));

    This code piece is needed only when we connect with Azure portal, but it is not needed in case of Azure Cosmos Db emulator. Could you please remove this code line and run the project again?

    ----------

    If an Answer is helpful, please “Accept Answer” or Up-Vote for the same which might be beneficial to other community members reading this thread.