Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2226

Return block value in GridFS when opening streams with application-provided blocks

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.0.0
    • Affects Version/s: None
    • Component/s: GridFS
    • Labels:
      None

      Currently gridfs open_upload_stream and open_download_stream methods return the stream when given the block. The convention in Ruby checked with e.g. File.open(...)

      { ... }

      is to return the result of block execution when the block is given. This ticket covers following the same convention in GridFS.

      This issue is more significant in reads because the following pattern does not work currently:

            actual = fs.open_download_stream(a.file_id) do |stream|
              stream.read
            end
      

      `actual` receives the stream, not the data read.

      This would be a 3.0 change since currently the stream provides the file_id method which is likely to be used by applications to determine the stream id. If this is needed with the change proposed in this ticket, the applications can return the stream as the block value.

            Assignee:
            Unassigned Unassigned
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: