-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.0.0
-
Component/s: Replica Set
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
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