I am using ipython 2.7. I am creating database name enron in mongodb. I have tried to connect to this database locally but the following error occurred – how do I fix it?
this my code:
JavaScript
x
7
1
import json
2
import pymongo # pip install pymongo
3
from bson import json_util
4
from pymongo import MongoClient# Comes with pymongo
5
conn = pymongo.Connection('mongodb://user:user123@localhost27017.mongolab.com:33499/enron')
6
client = MongoClient()
7
error:
JavaScript
1
2
1
ConnectionFailure: could not connect to localhost:27017: [Errno 10061] No connection could be made because the target machine actively refused it
2
Advertisement
Answer
Refer this PyMongo Connection to connect and Connection is deprecated