Commit c1290ac1 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added script to change upload.user_id. [skip ci]

parent 8f448ffb
from nomad import infrastructure
infrastructure.setup_logging()
mongo = infrastructure.setup_mongo()
calcs = mongo.fairdi_nomad_migration.calc
uploads = mongo.fairdi_nomad_migration.upload
def doit(upload):
example = calcs.find_one({'upload_id': upload})
user_id = example['metadata']['uploader']['id']
uploads.update_one({'_id': upload}, {'$set': {'user_id': user_id}})
for upload in uploads.distinct('_id'):
doit(upload)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment