| Class | Mongo::Server::Description |
| In: |
lib/mongo/server/description.rb
lib/mongo/server/description/features.rb |
| Parent: | Object |
Represents a description of the server, populated by the result of the ismaster command.
@since 2.0.0
| ARBITER | = | 'arbiterOnly'.freeze |
Constant for reading arbiter info from config.
@since 2.0.0 |
|
| ARBITERS | = | 'arbiters'.freeze |
Constant for reading arbiters info
from config.
@since 2.0.0 |
|
| HIDDEN | = | 'hidden'.freeze |
Constant for reading hidden info from config.
@since 2.0.0 |
|
| HOSTS | = | 'hosts'.freeze |
Constant for reading hosts info from
config.
@since 2.0.0 |
|
| MESSAGE | = | 'msg'.freeze |
Constant for the key for the message value.
@since 2.0.0 |
|
| MONGOS_MESSAGE | = | 'isdbgrid'.freeze |
Constant for the message that indicates a sharded cluster.
@since 2.0.0 |
|
| REPLICA_SET | = | 'isreplicaset'.freeze |
Constant for determining ghost servers.
@since 2.0.0 |
|
| MAX_BSON_OBJECT_SIZE | = | 'maxBsonObjectSize'.freeze |
Constant for reading max bson size info from config.
@since 2.0.0 |
|
| MAX_MESSAGE_BYTES | = | 'maxMessageSizeBytes'.freeze |
Constant for reading max message size info from config.
@since 2.0.0 |
|
| MAX_WIRE_VERSION | = | 'maxWireVersion'.freeze |
Constant for the max wire version.
@since 2.0.0 |
|
| MIN_WIRE_VERSION | = | 'minWireVersion'.freeze |
Constant for min wire version.
@since 2.0.0 |
|
| MAX_WRITE_BATCH_SIZE | = | 'maxWriteBatchSize'.freeze |
Constant for reading max write batch size.
@since 2.0.0 |
|
| LAST_WRITE | = | 'lastWrite'.freeze |
Constant for the lastWrite subdocument.
@since 2.4.0 |
|
| LAST_WRITE_DATE | = | 'lastWriteDate'.freeze |
Constant for the lastWriteDate field in the lastWrite subdocument.
@since 2.4.0 |
|
| ME | = | 'me'.freeze |
Constant for reading the me field.
@since 2.1.0 |
|
| DEFAULT_MAX_WRITE_BATCH_SIZE | = | 1000.freeze |
Default max write batch size.
@since 2.0.0 |
|
| LEGACY_WIRE_VERSION | = | 0.freeze |
The legacy wire protocol version.
@since 2.0.0 @deprecated Will be removed in 3.0. |
|
| PASSIVE | = | 'passive'.freeze |
Constant for reading passive info from config.
@since 2.0.0 |
|
| PASSIVES | = | 'passives'.freeze |
Constant for reading the passive server list.
@since 2.0.0 |
|
| PRIMARY | = | 'ismaster'.freeze |
Constant for reading primary info from config.
@since 2.0.0 |
|
| PRIMARY_HOST | = | 'primary'.freeze |
Constant for reading primary host field from config.
@since 2.5.0 |
|
| SECONDARY | = | 'secondary'.freeze |
Constant for reading secondary info from config.
@since 2.0.0 |
|
| SET_NAME | = | 'setName'.freeze |
Constant for reading replica set name info from config.
@since 2.0.0 |
|
| TAGS | = | 'tags'.freeze |
Constant for reading tags info from
config.
@since 2.0.0 |
|
| ELECTION_ID | = | 'electionId'.freeze |
Constant for reading electionId info from config.
@since 2.1.0 |
|
| SET_VERSION | = | 'setVersion'.freeze |
Constant for reading setVersion info from config.
@since 2.2.2 |
|
| LOCAL_TIME | = | 'localTime'.freeze |
Constant for reading localTime info from config.
@since 2.1.0 |
|
| OPERATION_TIME | = | 'operationTime'.freeze |
Constant for reading operationTime info from config.
@since 2.5.0 |
|
| LOGICAL_SESSION_TIMEOUT_MINUTES | = | 'logicalSessionTimeoutMinutes'.freeze |
Constant for reading logicalSessionTimeoutMinutes info from config.
@since 2.5.0 |
|
| EXCLUDE_FOR_COMPARISON | = | [ LOCAL_TIME, LAST_WRITE, OPERATION_TIME, Operation::CLUSTER_TIME ].freeze |
Fields to exclude when comparing two descriptions.
@since 2.0.6 |
| address | [R] | @return [ Address ] address The server‘s address. |
| average_round_trip_time | [R] | @return [ Float ] The moving average time the ismaster call took to complete. |
| config | [R] | @return [ Hash ] The actual result from the ismaster command. |
| last_update_time | [R] |
Time when the server was last checked.
@return [ Time ] Last check time. @since 2.7.0 |
Instantiate the new server description from the result of the ismaster command.
@example Instantiate the new description.
Description.new(address, { 'ismaster' => true }, 0.5)
@param [ Address ] address The server address. @param [ Hash ] config The result of the ismaster command. @param [ Float ] average_round_trip_time The moving average time (sec) the ismaster
call took to complete.
@since 2.0.0
Check equality of two descriptions.
@example Check description equality.
description == other
@param [ Object ] other The other description.
@return [ true, false ] Whether the objects are equal.
@since 2.0.6
Will return true if the server is an arbiter.
@example Is the server an arbiter?
description.arbiter?
@return [ true, false ] If the server is an arbiter.
@since 2.0.0
Whether this description is from a data-bearing server (standalone, mongos, primary or secondary).
@return [ true, false ] Whether the description is from a data-bearing
server.
@since 2.7.0
Get the electionId from the config.
@example Get the electionId.
description.election_id
@return [ BSON::ObjectId ] The election id.
@since 2.1.0
Is the server a ghost in a replica set?
@example Is the server a ghost?
description.ghost?
@return [ true, false ] If the server is a ghost.
@since 2.0.0
Will return true if the server is hidden.
@example Is the server hidden?
description.hidden?
@return [ true, false ] If the server is hidden.
@since 2.0.0
Inspect the server description.
@example Inspect the server description
description.inspect
@return [ String ] The inspection.
@since 2.0.0
Is this description from the given server.
@example Check if the description is from a given server.
description.is_server?(server)
@return [ true, false ] If the description is from the server.
@since 2.0.6
Get the lastWriteDate from the lastWrite subdocument in the config.
@example Get the lastWriteDate value.
description.last_write_date
@return [ Time ] The last write date.
@since 2.4.0
Get the logicalSessionTimeoutMinutes from the config.
@example Get the logicalSessionTimeoutMinutes value in minutes.
description.logical_session_timeout
@return [ Integer, nil ] The logical session timeout in minutes.
@since 2.5.0
Get the max BSON object size for this server version.
@example Get the max BSON object size.
description.max_bson_object_size
@return [ Integer ] The maximum object size in bytes.
@since 2.0.0
Get the max message size for this server version.
@example Get the max message size.
description.max_message_size
@return [ Integer ] The maximum message size in bytes.
@since 2.0.0
Get the maximum wire version.
@example Get the max wire version.
description.max_wire_version
@return [ Integer ] The max wire version supported.
@since 2.0.0
Get the maximum batch size for writes.
@example Get the max batch size.
description.max_write_batch_size
@return [ Integer ] The max batch size.
@since 2.0.0
Get the minimum wire version.
@example Get the min wire version.
description.min_wire_version
@return [ Integer ] The min wire version supported.
@since 2.0.0
opTime in lastWrite subdocument of the ismaster response.
@return [ BSON::Timestamp ] The timestamp.
@since 2.7.0
Is the description of type other.
@example Is the description of type other.
description.other?
@return [ true, false ] If the description is other.
@since 2.0.0
Will return true if the server is passive.
@example Is the server passive?
description.passive?
@return [ true, false ] If the server is passive.
@since 2.0.0
Will return true if the server is a primary.
@example Is the server a primary?
description.primary?
@return [ true, false ] If the server is a primary.
@since 2.0.0
Get the address of the primary host.
@example Get the address of the primary.
description.primary_host
@return [ String | nil ] The address of the primary.
@since 2.6.0
Does this description correspond to a replica set member.
@example Check if the description is from a replica set member.
description.replica_set_member?
@return [ true, false ] If the description is from a replica set
member.
@since 2.0.6
Get the name of the replica set the server belongs to, returns nil if none.
@example Get the replica set name.
description.replica_set_name
@return [ String, nil ] The name of the replica set.
@since 2.0.0
Will return true if the server is a secondary.
@example Is the server a secondary?
description.secondary?
@return [ true, false ] If the server is a secondary.
@since 2.0.0
Returns the server type as a symbol.
@example Get the server type.
description.server_type
@return [ Symbol ] The server type.
@since 2.4.0
Get the setVersion from the config.
@example Get the setVersion.
description.set_version
@return [ Integer ] The set version.
@since 2.2.2
Is this server a standalone server?
@example Is the server standalone?
description.standalone?
@return [ true, false ] If the server is standalone.
@since 2.0.0