You say "connecting to a remote server" but your code reports "localhost:27017" which is the default for MongoClient. Supply an appropriate hostname to MongoCLient
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/viRHsCygDfU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/25916fa0-d212-439e-bca7-ed9f93c08c7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi
When I am trying to execute the scripts,It is giving me an Error of Server Selection Timeout and I dont understand how to rectify it.
ServerSelectionTimeoutError: localhost:27017: [Errno 10061] No connection could be made because the target machine actively refused it
That error is typically caused by trying to connect to a server that either has no MongoDB running, or the port is being blocked by a firewall. Could you please check that MongoDB is running, and you can connect to it using the mongo
shell?
Also, this part in the code you posted:
Client = MongoClient()
Means that MongoClient will attempt to connect to localhost:27017
by default (see Pymongo MongoClient default values) as Rhys has mentioned. Have you modified the MongoClient()
setting to point to the relevant server?
I tried it but it throws me the same error.
Could you post what you have tried and the error you see?
Best regards,
Kevin