2

I am build a Flask app using Azure Cosmos DB for MongoDB API and I am having a connection error in the following lines. I am following this tut: https://github.com/Azure-Samples/CosmosDB-Flask-Mongo-Sample

I am getting error in the following line:

client = MongoClient("mongodb://127.0.0.1:10250/?ssl=true") 

When I run the flask server, I get this error: pymongo.errors.ConnectionFailure: [WinError 10061] No connection could be made because the target machine actively refused it. Can anyone resolve it?

0

2 Answers 2

1

I totally followed the tut you provided and it works fine for me.

Run LOG:

enter image description here

View URL:

enter image description here

Based on the error:

pymongo.errors.ConnectionFailure: [WinError 10061] No connection could be made because the target machine actively refused it.

It seems that you didn't open COSMOS DB emulator,please check the status of it.

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Thankyou for your comment! I got it, had a small bug in the url!
@YuneebAzam Cheers! You could mark the answer for others' reference,thanks.
0

Try to run the emulator with the command from the cmd:

> cd "C:\Program Files\Azure Cosmos DB Emulator"
> .\CosmosDB.Emulator.exe /EnableMongoDbEndpoint

2 Comments

How your answer will help OP?
I was getting the same error since I was starting the Cosmos DB Emulator with double cliking the icon and it seems that the mongodb endpoint was not enabled

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.