Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed TypeError: 'Collection' object is not callable #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gerapy_item_pipeline/mongodb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pymongo
from gerapy_item_pipeline.settings import *
from .settings import *


class MongoDBPipeline(object):
Expand Down Expand Up @@ -62,13 +62,13 @@ def process_item(self, item, spider):
item.get(self.item_primary_key_field,
self.item_primary_key_default)
if self.upsert:
self.db[collection_name].update({
self.db[collection_name].update_one({
primary_key_field: item.get(primary_key_field)
}, {
'$set': item
}, upsert=True)
else:
self.db[collection_name].insert(item)
self.db[collection_name].insert_one(item)
return item

def close_spider(self, spider):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scrapy>=2.0.0
pymongo
pymongo>=4,<5.0