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

replica set uri sets wrong cluster mode

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.0
    • Affects Version/s: 2.0.0
    • Component/s: Replica Set
    • None

      Given a URI for a replica set, the cluster mode is set wrong to Standalone when it should be ReplicaSet.

      Example:

          p mongodb_uri
          # "mongodb://localhost:1087,localhost:1088,localhost:1089/test? 
          replicaSet=replica_sets_arbiter"
          client = Mongo::Client.new(mongodb_uri)
          p client.cluster.mode
          # Mongo::Cluster::Mode::Standalone
      

      client.cluster.mode should be Mongo::Cluster::Mode::ReplicaSet

      Possible fix:

          module Mongo
            class Client
              def create_from_uri(connection_string, options = {})
                uri = URI.new(connection_string)
                @options = options.merge(uri.client_options).freeze
                @cluster = Cluster.new(self, uri.servers, @options)
                @database = Database.new(self, @options[:database])
              end
            end
          end
      

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            gjmurakami Gary Murakami
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: