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

Database#command method lacks options for read preference and tags

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Public API
    • Labels:
      None

      Description

      Implementation is probably just in the schedule, but without this read preference for an individual command would be very cumbersome for the user.

      Here's a patch that works for me provided that previous fixes are made.

        class Database
          def command(operation, options = {})
            server_preference = options[:read] ? ServerPreference.get(options[:read]) : client.server_preference
            server = server_preference.select_servers(cluster.servers).first
            raise Mongo::NoReadPreference.new("No replica set member available for query with read preference matching mode #{client.server_preference.name.to_s}") unless server
            Operation::Command.new({
              :selector => operation,
              :db_name => name,
              :options => { :limit => -1 }
            }).execute(server.context)
          end
        end

        Attachments

          Activity

            People

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            gjmurakami Gary Murakami
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: