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 = nil, max_staleness_seconds : Int32 | Nil = nil, hedge : BSON | Nil = 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 | Nil
- #max_staleness_seconds : Int32 | Nil
- #mode : String
- #tags : Array(BSON) | Nil
-
#to_bson(bson = BSON.new)
Converts to a BSON representation.
Constructor Detail
def self.new(mode : String, tags : Array(BSON) | Nil = nil, max_staleness_seconds : Int32 | Nil = nil, hedge : BSON | Nil = 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