Skip to content

Commit

Permalink
⬆️ Upgrade the pymongo calls to the latest version
Browse files Browse the repository at this point in the history
`save` -> `replace_one` with upsert
`remove` -> `delete_one`
  • Loading branch information
shankari committed Apr 14, 2024
1 parent de11585 commit ae7996c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/debug/fix_usercache_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

def fix_usercache_errors():
copy_to_usercache()
print(">" * 30)
move_to_long_term()

def copy_to_usercache():
Expand All @@ -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")

Expand Down

0 comments on commit ae7996c

Please sign in to comment.