Class | Moped::ReadPreference::SecondaryPreferred |
In: |
lib/moped/read_preference/secondary_preferred.rb
|
Parent: | Object |
Select a secondary node from the cluster. If no secondary is available then use a primary. If no primary is found then an exception will be raised.
@example Read a secondary or primary node from the cluster.
preference.with_node(cluster) do |node| node.command(ismaster: 1) end
@note If tag sets are provided then secondary selection will need to
match the provided tags.
@param [ Cluster ] cluster The cluster of nodes to select from.
@raise [ Errors::ConnectionFailure ] If no secondary or primary node was
available in the cluster.
@return [ Object ] The result of the block.
@since 2.0.0