struct Mongo::ReadPreference
- Mongo::ReadPreference
- Struct
- Value
- Object
Overview
The read preference describes how MongoDB clients route read operations to the members of a replica set.
See: the official documentation.
Included Modules
- BSON::Serializable
Defined in:
cryomongo/read_preference.crConstructors
- .new(mode : String, tags : Array(BSON)? = nil, max_staleness_seconds : Int32? = nil, hedge : BSON? = nil)
-
.new(bson : BSON)
Allocate an instance and copies data from a BSON struct.
Class Method Summary
-
.from_bson(bson : BSON)
NOTE See
self.new
.
Instance Method Summary
- #clone
- #copy_with(mode _mode = @mode, tags _tags = @tags, max_staleness_seconds _max_staleness_seconds = @max_staleness_seconds, hedge _hedge = @hedge)
- #hedge : BSON?
- #max_staleness_seconds : Int32?
- #mode : String
- #tags : Array(BSON)?
-
#to_bson(bson = BSON.new)
Converts to a BSON representation.
Constructor Detail
def self.new(mode : String, tags : Array(BSON)? = nil, max_staleness_seconds : Int32? = nil, hedge : BSON? = nil)
#
def self.new(bson : BSON)
#
Allocate an instance and copies data from a BSON struct.
class User
include BSON::Serializable
property name : String
end
data = BSON.new
data["name"] = "John"
User.new(data)
Class Method Detail
Instance Method Detail
def copy_with(mode _mode = @mode, tags _tags = @tags, max_staleness_seconds _max_staleness_seconds = @max_staleness_seconds, hedge _hedge = @hedge)
#
def to_bson(bson = BSON.new)
#
Converts to a BSON representation.
user = User.new name: "John"
bson = user.to_bson