Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-987

GridFS.findOne needs a variant that takes a ReadPreference

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.0
    • Affects Version/s: None
    • Component/s: API, GridFS
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      For our app we've setup a replica set and chosen to use a secondary-preferred read preference to help distribute requests and recover from node failures. We have the DB configured for secondary preferred and set read preference to primary on a per-request basis - for read and update type operations.

      This fails when dealing with GridFS because their is no ability to provide a read preference in the GridFS API. I started working on a workaround, reading from the bucket.fs collection and passing the preference that way.

      But now the problem is that when reading file chunks, the input stream is reading from the chunks collection with the database default read preference of secondary-preferred. Consequently, I'm going to have to reimplement that in our app to get going. But it sure would be nice if I didn't have to do that.

            Assignee:
            Unassigned Unassigned
            Reporter:
            rwallace@atlassian.com Richard Wallace
            None
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: