import pymongoMONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_DB = 'today'
MONGO_COLL = 'mm'class MingyanPipeline(object):
def process_item(self, item, spider): # mongo
mongo_client = pymongo.MongoClient(host=MONGO_HOST, port=MONGO_PORT)
db = mongo_client[MONGO_DB]
coll = db[MONGO_COLL]
coll.insert(dict(item)) return item