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?
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e93be0-5c29b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e93be0-5c29b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?