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.

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: API
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            shane.harvey Shane Harvey
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: