I am scraping the data using scrapy.Now i want to store the data in mongo db for that i install pymongo
but i am unable to connect to the databse
Here is my code for settings.py
ITEM_PIPELINES = ['tutorial.pipelines.TutorialPipeline',]
MONGODB_SERVER = "localhost"
MONGODB_PORT = 27017
MONGODB_DB = "test"
MONGODB_COLLECTION = "raw_prod"
Here is the code for pipelines.py
import pymongo
from pymongo import Connection
class TutorialPipeline(object):
def __init__(self):
connection = pymongo.Connection(settings['MONGODB_SERVER'], settings['MONGODB_PORT'])
db = connection[settings['MONGODB_DB']]
self.collection = db[settings['MONGODB_COLLECTION']]
I am getting the following error
cannot import name Connection
Where am i going wrong??