Azure / azure-cosmos-dotnet-v2

Contains samples and utilities relating to the Azure Cosmos DB .NET SDK
MIT License
579 stars 837 forks source link

MongoDB driver unable to connect local emulator #256

Open GufCab opened 7 years ago

GufCab commented 7 years ago

From a microsoft article it is specified that the local emulator can be reached through the MongoDB .NET driver, using the connectionstring: mongodb://localhost:C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==@localhost:10250/admin?ssl=true&3t.sslSelfSignedCerts=true

The article in question: https://docs.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator

When trying this, the mongoDB driver will wait for 30 seconds (default timeout) and throw a timeout exception.

If using a connection string pointing to a DocumentDB created in Azure, but otherwise same setup, everything works perfectly.

kroffdaddy commented 7 years ago

Same for me (v1.13.58.2). When running netstat -an in PowerShell when the emulator is running, I can see that there is nothing listening on port 10250. Port 8081 appears in the list though and the GUI is there, so it looks like it's only the MongoDB API that is broken.

GufCab commented 7 years ago

Just to confirm, I get the same results when running netstat as @kroffdaddy

AndrewHoh commented 7 years ago

Hi, can you do a quick check to see if port 10255 responds?

kroffdaddy commented 7 years ago

Same error. Also not showing up in netstat -an.

kroffdaddy commented 7 years ago

The latest version listens to the MongoDB API port 10250, but it's a bit tricky to find it, since this page still points to the old version.

The correct download link is https://aka.ms/cosmosdb-emulator.

ealsur commented 7 years ago

Thanks @kroffdaddy for the download link report.

Sheoshobhit commented 7 years ago

I Have installed the latest version of emulator, and I can see both port 10250 and 10255 pointing to DocumentDB. Gateway Services but when i try to conenct using either of the two port I get the timeout exception

sittingbool commented 4 years ago

Will this be solved some day? I am running in docker, same issue. Only ports 10251, 10252 10253 and 10254 are connected using that netstat -an command. Neither of them I can connect with on mongo shell or compass.

loraderon commented 4 years ago

Since version 2.4.3 there is a new switch (/EnableMongoDbEndpoint) in town so you have to provide that to enable the mongo api. Not that visible at all!

https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator-release-notes#243

Disabled starting the MongoDB service by default. Only the SQL endpoint is enabled as default. The user must start the endpoint manually using the emulator's "/EnableMongoDbEndpoint" command-line option. Now, it's like all the other service endpoints, such as Gremlin, Cassandra, and Table.

https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator#azure-cosmos-dbs-api-for-mongodb

Start emulator from command prompt as an administrator with "/EnableMongoDbEndpoint".

sittingbool commented 4 years ago

Thank you very much @loraderon. That was well hidden in the docs. And not in the German version I read. But do you also know what is the env variable for this? Since I am using it on docker...

sittingbool commented 4 years ago

Btw. Docker is telling me that it in fact started the MongoDB endpoint

Key   : MongoDBEndpoint
Value : {mongodb://559b0bc4b437:10255/, mongodb://172.22.12.105:10255/}
Name  : MongoDBEndpoint
smoolya17 commented 4 years ago

Since version 2.4.3 there is a new switch (/EnableMongoDbEndpoint) in town so you have to provide that to enable the mongo api. Not that visible at all!

https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator-release-notes#243

Disabled starting the MongoDB service by default. Only the SQL endpoint is enabled as default. The user must start the endpoint manually using the emulator's "/EnableMongoDbEndpoint" command-line option. Now, it's like all the other service endpoints, such as Gremlin, Cassandra, and Table.

https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator#azure-cosmos-dbs-api-for-mongodb

Start emulator from command prompt as an administrator with "/EnableMongoDbEndpoint".

How do we enable this endpoint on azure service? Do we have a command prompt? Do i raise a seperate request for this? @loraderon