From ae7996c796f94160c6f90c80531670a86945f2f1 Mon Sep 17 00:00:00 2001 From: Shankari Date: Sat, 13 Apr 2024 19:18:52 -0700 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20=20Upgrade=20the=20pymongo?= =?UTF-8?q?=20calls=20to=20the=20latest=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `save` -> `replace_one` with upsert `remove` -> `delete_one` --- bin/debug/fix_usercache_processing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/debug/fix_usercache_processing.py b/bin/debug/fix_usercache_processing.py index 7187177e6..0158705b3 100644 --- a/bin/debug/fix_usercache_processing.py +++ b/bin/debug/fix_usercache_processing.py @@ -27,6 +27,7 @@ def fix_usercache_errors(): copy_to_usercache() + print(">" * 30) move_to_long_term() def copy_to_usercache(): @@ -37,8 +38,8 @@ def copy_to_usercache(): logging.info("Found %d errors in this round" % edb.get_timeseries_error_db().estimated_document_count()) for error in error_it: logging.debug("Copying entry %s" % error["metadata"]) - save_result = uc.save(error) - remove_result = te.remove(error["_id"]) + save_result = uc.replace_one({"_id": error['_id']}, error, upsert=True) + remove_result = te.delete_one({"_id": error["_id"]}) logging.debug("save_result = %s, remove_result = %s" % (save_result, remove_result)) logging.info("step copy_to_usercache DONE")