Currently, this nested for loop takes almost an hour to run through. I am hoping to rewrite it and create some parallel synchronization. I have not found an answer anywhere on how to do something nested like I have below. Any pointers in the right direction would be greatly appreciated.
#used to update the Software Name's from softwareCollection using the regexCollection
startTime = time.time()
for x in softwareCollection.find({}, {"Software Name":-1,"Computer Name":-1,"Version":-1,"Publisher":-1,"reged": null }, no_cursor_timeout=True):
for y in regexCollection.find({}, {"regName": 1,"newName":1}, no_cursor_timeout=True):
try:
regExp = re.compile(y["regName"])
except:
print(y["regName"])
break
oldName = x["Software Name"]
newName = y["newName"]
if(regExp.search(oldName)):
x["Software Name"] = newName
x["reged"] = "true"
softwareCollection.save(x)
break
else:
continue
print(startTime - time.time() / 60)
cursor.close()