I have some simple code to mark an error as solved
doc = self.data.find_one({"id": int(errid)})
print(doc)
updt = self.data.update_one(filter={"id": errid}, update={"$set": {"fixed": True}})
doc = self.data.find_one({"id": int(errid)})
print(f"{doc}\n\n{str(updt.upserted_id)}\n\n{updt.acknowledged}")
print(f"Successfully fixed error {errid}")
(yes, all the vars are defined)
The first time I print doc
, I get
{'_id': ObjectId('5fc048878dc1679d5d880f6b'), 'id': 12, 'command': 'errortest', 'fulltb': 'https://hastebin.com/otepiqihim', 'datetime': datetime.datetime(2020, 11, 27, 0, 29, 59, 708000), 'fixed': False}
The second time, I get the exact same result. The update is acknowledged, (updt.acknowleged
) but the ID is None
(updt.upserted_id
)
I don't get any errors either. Does anyone know why this could be happening?
If your errid is a string, you're casting it to an int in all places except om the update command
should be: