add export and import util to support v1 to v2 upgrade

This commit is contained in:
Florian Baumann 2023-06-28 09:32:39 +02:00
parent f0c82cf325
commit ca04ee1ab1

15
utils/export.py Normal file
View File

@ -0,0 +1,15 @@
from pymongo import MongoClient
import os
import pymongo
CONNECTION_STRING = os.getenv("MONGODB_URI")
client = MongoClient(CONNECTION_STRING+'/admin')
# Create a new collection
collection = client["serra"]["cards"]
cards=collection.find()
for c in cards:
print("./serra add %s/%s -c %s" % (c["set"], c["collectornumber"], c["serra_count"]))