2 Debugging Connection Errors
JasonYeMSFT редактировал(а) эту страницу 2024-03-01 15:33:45 -08:00

Connecting to Mongo DB via Azure Cosmos DB Emulator (Windows)

Try the following:

  1. Make sure you have the Azure Cosmos DB Emulator installed (https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator)
  2. Make sure the emulator has been started, with the MongoDB endpoint enabled (it is no longer enabled by default as of version 2.4.3, see https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator). For example (change path appropriately):
"C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /EnableMongoDbEndpoint
  1. Make sure the cosmosDB.emulator.mongoPort setting in vscode matches the port used by the emulator. By default this is 10255.

For more information, see https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator.

Note: if you encounter an error saying the mongo shell version is not supported. You may be able to specify the version of your mongo shell in the emulator command line argument. You can refer to CosmosDB emulator windows arguments to find out all the supported mongo shell versions.

Connecting to local Mongo DB server

Make sure Mongo DB has been installed as a service or else has been started manually, for example (Windows):

c:\Program Files\MongoDB\Server\4.2\bin\mongod.exe