I'm trying to set noCursorTimeout in the session following this instruction from MongoDB docs.
But I'm getting the error: AttributeError: 'Cursor' object has no attribute 'noCursorTimeout'
I can't wonder why I'm getting this.
from pymongo import MongoClient as Connection
from datetime import datetime
conn = Connection(get_uri())
with conn as conn:
collection = conn['db_name']['my_collection']
documents_cursor = collection.find(query).noCursorTimeout() # same with .maxTimeMS()
According to the document, you should use it like this:
cursor = collection.find({"a": 1}, no_cursor_timeout=True)