Erster Commit des bestehenden monolithischen WinForms-Copytraders, inklusive der Alt-Backups (*.bak), damit diese dauerhaft in der Historie rekonstruierbar bleiben. Threema-Lib unter libs/ wurde vendored (nested .git entfernt). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
15 lines
391 B
Python
15 lines
391 B
Python
from pymongo import MongoClient
|
|
from bson.objectid import ObjectId
|
|
|
|
client = MongoClient('mongodb://localhost:27017/')
|
|
db = client['PolyTraderDB']
|
|
col = db['closed_trades']
|
|
|
|
deleted = 0
|
|
for doc in col.find({}):
|
|
if isinstance(doc['_id'], ObjectId):
|
|
col.delete_one({'_id': doc['_id']})
|
|
deleted += 1
|
|
|
|
print(f"Deleted {deleted} invalid ObjectId records from closed_trades.")
|