How to solve attribute error: 'Cursor' object has no attribute 'noCursorTimeout' in pymongo?

Viewed 1613

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()
1 Answers
Related