Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1356

Add ability to iterate all documents in a tailable cursor in a single for loop.

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Do
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: API
    • Labels:
      None

      Iterating all documents in a tailable cursor currently requires multiple for loops:

      while tailable_cursor.alive:
          for doc in tailable_cursor:
              print(doc)
          print('getMore returned 0 documents') 
      

      It would be nice if there was a way to iterate all the documents in a single loop:

      for doc in tailable_cursor:
          print(doc)
      

      However, we can't make this the default behavior because applications may rely on breaking out of the loop.

            Assignee:
            Unassigned Unassigned
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: