You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.1 KiB
25 lines
1.1 KiB
from _arango import arango |
|
|
|
db = arango.db |
|
|
|
|
|
persons = list(db.aql.execute("for doc in persons filter doc.other != true return doc")) |
|
|
|
for person in persons: |
|
person_id = person['_id'] |
|
if 'mentioned_in_interrogation' in person: |
|
for interrogation in person['mentioned_in_interrogation']: |
|
interrogation = db.collection('interrogations').get(interrogation) |
|
if 'mentioned_persons' not in interrogation: |
|
interrogation['mentioned_persons'] = [] |
|
if person_id not in interrogation['mentioned_persons']: |
|
interrogation['mentioned_persons'].append(person_id) |
|
print(interrogation['mentioned_persons'], interrogation['_key']) |
|
db.collection('interrogations').update(interrogation, merge=False) |
|
|
|
interrogations = list(db.collection("interrogations").all()) |
|
|
|
for interrogation in interrogations: |
|
if 'mentioned_persons' in interrogation: |
|
interrogation['mentioned_persons'] = list(set(interrogation['mentioned_persons'])) |
|
db.collection('interrogations').update(interrogation, merge=False) |