From 8af915f65fa021a97b2eeaf9893167f511ce81b9 Mon Sep 17 00:00:00 2001 From: shengchenyang <15538221825@163.com> Date: Sat, 19 Oct 2024 11:30:14 +0800 Subject: [PATCH] refactor: change mongodb update rules --- ayugespidertools/common/mongodbpipe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ayugespidertools/common/mongodbpipe.py b/ayugespidertools/common/mongodbpipe.py index 76bfe98..75440a2 100644 --- a/ayugespidertools/common/mongodbpipe.py +++ b/ayugespidertools/common/mongodbpipe.py @@ -83,7 +83,7 @@ def _default_storage( if not item_dict.get("_mongo_update_rule"): db[collection_name].insert_one(insert_data) else: - db[collection_name].update_many( + db[collection_name].update_one( item_dict["_mongo_update_rule"], {"$set": insert_data}, True ) @@ -166,7 +166,7 @@ async def _data_storage_logic( # type: ignore[override] if not item_dict.get("_mongo_update_rule"): await db[collection_name].insert_one(insert_data) else: - await db[collection_name].update_many( + await db[collection_name].update_one( item_dict["_mongo_update_rule"], {"$set": insert_data}, True )