From 3a5ff07ef067e306c508e40a3d7bfc3531cf3596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20de=20Pal=C3=A9zieux?= Date: Thu, 23 Dec 2021 17:25:16 +0100 Subject: [PATCH] Don't explicitly create a collection, it will be created automatically when a document is inserted. Trying to explicity create a collection that exists causes an exception in pymongo. --- mongo_connector/doc_managers/mongo_doc_manager.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mongo_connector/doc_managers/mongo_doc_manager.py b/mongo_connector/doc_managers/mongo_doc_manager.py index 5814a1b7..708d2c90 100644 --- a/mongo_connector/doc_managers/mongo_doc_manager.py +++ b/mongo_connector/doc_managers/mongo_doc_manager.py @@ -145,11 +145,6 @@ def handle_command(self, doc, namespace, timestamp): if a and b: self.mongo.admin.command("renameCollection", a, to=b) - if doc.get("create"): - new_db, coll = self.command_helper.map_collection(db, doc["create"]) - if new_db: - self.mongo[new_db].create_collection(coll) - if doc.get("drop"): new_db, coll = self.command_helper.map_collection(db, doc["drop"]) if new_db: