http://stackoverflow.com/questions/37705231/pymongo-error-server-timeout
I installed the latest version of Pymongo 3.2.2 using pip. Additionally I use Python 3.4 Anaconda. I am trying to do a simple insert. Here is my code:
>>> from pymongo import MongoClient
>>> client = MongoClient()
>>> client["mydb"]
Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'mydb')
>>> db = client["mydb"]
>>> db["mycollection"]
Collection(Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'mydb'), 'mycollection')
>>> book = {}
>>> book["title"] = "AnyBook"
>>> book["Author"] = "AnyAuthor"
>>> collection.insert(book)This is the message I get at the bottom of the Traceback:
Traceback (most recent call last):
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 8] nodename nor servname provided, or not knownHow can I fix this so that I can insert a record into MongoDB?