Class Mongo::MongoShardedClient
In: lib/mongo/mongo_sharded_client.rb
Parent: MongoReplicaSetClient

Instantiates and manages connections to a MongoDB sharded cluster for high availability.

Methods

Included Modules

ThreadLocalVariableManager

Constants

SHARDED_CLUSTER_OPTS = [:refresh_mode, :refresh_interval, :tag_sets, :read]

Attributes

manager  [R] 
refresh_interval  [R] 
refresh_mode  [R] 
refresh_version  [R] 
seeds  [R] 

Public Class methods

Initialize a connection to MongoDB using the MongoDB URI spec.

@param uri [ String ] string of the format:

  mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/database]

@param opts [ Hash ] Any of the options available for MongoShardedClient.new

@return [ Mongo::MongoShardedClient ] The sharded client.

Public Instance methods

Initiate a connection to the sharded cluster.

Force a hard refresh of this connection‘s view of the sharded cluster.

@return [Boolean] true if hard refresh

  occurred. +false+ is returned when unable
  to get the refresh lock.

Returns true if it‘s okay to read from a secondary node. Since this is a sharded cluster, this must always be false.

This method exist primarily so that Cursor objects will generate query messages with a slaveOkay value of true.

@return [Boolean] true

[Validate]