I am using PyMongo and trying to iterate over (10 millions) documents in my MongoDB collection and just extract a couple of keys: \"name\" and \"address\", then output them to .
I had no luck with .find().forEach() either, but this should find what you are searching for and then print it.
First find all documents that match what you are searching for
cursors = db.myCollection.find({"name": {$regex: REGEX}})
then iterate it over the matches
for cursor in cursors
print(cursor.get("name"))