When attempting to connect to the local emulator for Azure CosmosDB with the MongoDB connection string mongodb://localhost:C2y6yDjf5%2FR%2Bob0N8A7Cgv30VRDJIWEHLM%2B4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw%2FJw%3D%3D@localhost:10255/admin?ssl=true
, I am receiving the following error:
{ MongoNetworkError: failed to connect to server [localhost:10255] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:10255]
at Pool.<anonymous> (D:\github\myapp\node_modules\mongodb-core\lib\topologies\server.js:431:11)
at Pool.emit (events.js:189:13)
at connect (D:\github\myapp\node_modules\mongodb-core\lib\connection\pool.js:557:14)
at makeConnection (D:\github\myapp\node_modules\mongodb-core\lib\connection\connect.js:39:11)
at callback (D:\github\myapp\node_modules\mongodb-core\lib\connection\connect.js:261:5)
at TLSSocket.err (D:\github\myapp\node_modules\mongodb-core\lib\connection\connect.js:286:7)
at Object.onceWrapper (events.js:277:13)
at TLSSocket.emit (events.js:189:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
name: 'MongoNetworkError',
errorLabels: [ 'TransientTransactionError' ],
[Symbol(mongoErrorContextSymbol)]: {} }
I have installed the latest version of the emulator (currently v2.4.5) from the Microsoft Download Center and followed the installation instructions according to the Microsoft docs
I have tried connecting using Mongoose connect with Node.js (which works perfectly with the Azure cloud configuration), and using the VS Code Azure CosmosDB extension. Both yield the same error.
What is the proper way to connect to the local emulator?