Uploaded image for project: 'Swift Driver'
  1. Swift Driver
  2. SWIFT-675

Iterate over Result<T> in MongoCursor

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 1.0.0-rc0
    • None
    • None

    Description

      Currently, we have no way of signaling to users (or ourselves) that an error has been encountered while iterating a cursor via next(), since that method cannot throw according to the Sequence protocol. In order to determine if an error has occurred, one must check the  .error property on the cursor after iteration has completed, which is easy to forget (as evidenced by SWIFT-652 and some user cases).

      In order to signal to users than errors have occurred, we could iterate over Result<T> instead of just T, similar to how it is done in the Rust driver.

      Attachments

        Activity

          People

            ali.mir@mongodb.com Ali Mir
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: