The loop of cursor in pyMongo is very slow, is there any effective way to solve it?

there are 200000 data in the data, and each data has a typical list of words of 5000 length [{aVl1}, {bju 2},.], and typical dictionaries of 5000 length {{aRom 1}, {bjr 2},.}, use pyMongo to find100 data, the traversal of cursor is particularly slow, is there any effective way to speed up?

cursor = col.find({"id": {"$in": nodes}})

for i in cursor:

   do something
   
   

Thank you ~


  1. you can first export the data in mongo to a file by bash command mongoexport, and then process
  2. by reading the contents of the file.
  3. data = list (col.find ({'id': {"$in": nodes}})) load directly into memory for a try? Is the id field indexed?
Menu