From 4450cae6ea06811787d504de0c74b05a2d126a1e Mon Sep 17 00:00:00 2001 From: Juan Grigera Date: Thu, 6 Aug 2020 11:48:04 +0100 Subject: [PATCH] changed .collection_names to .listCollections for compatibility with MongoDB >3.x --- scrapy_pipelines/pipelines/mongo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scrapy_pipelines/pipelines/mongo.py b/scrapy_pipelines/pipelines/mongo.py index 95f9752..01478de 100644 --- a/scrapy_pipelines/pipelines/mongo.py +++ b/scrapy_pipelines/pipelines/mongo.py @@ -134,7 +134,7 @@ def open_spider(self, spider: Spider): name=self.settings.get("PIPELINE_MONGO_USERNAME"), ) try: - yield self.database.collection_names() + yield self.database.command("listCollections") except OperationFailure as err: LOGGER.error(str(err)) self.crawler.engine.close_spider(spider=spider, reason=str(err))