I'm using the MongoDB API on Python and was trying to iterate over the results of a query, I know that the find() method returns me a cursor and that I can iterate through it like a list in python. the code I was running looks like this:
query_results = mongo_collection.find(query)
emails_dict = {x.get("userId"): x.get("emailAddr") for x in query_results}
send_emails_dict = {x.get("userId"): x.get("sendEmailNotification") for x in query_results}
But for some strange reason both the dictionaries that I'm trying to create are returned as empty, I checked the results of the query and it's not empty, meaning that there are documents in the query_result. Any clue what's going on? Is this a know bug from pymongo?