struct Mongo::WriteConcern
- Mongo::WriteConcern
- Struct
- Value
- Object
Overview
Write concern describes the level of acknowledgment requested from MongoDB for write operations to a standalone mongod or to replica sets or to sharded clusters.
In sharded clusters, mongos instances will pass the write concern on to the shards.
See: the official documentation
Included Modules
- BSON::Serializable
Defined in:
cryomongo/concerns.crConstructors
-
.new(bson : BSON)
Allocate an instance and copies data from a BSON struct.
-
.new(j : Bool? = nil, w : Int32? | String? = nil, w_timeout : Int64? = nil)
Create a WriteConcern instance.
Class Method Summary
-
.from_bson(bson : BSON)
NOTE See
self.new
.
Instance Method Summary
-
#j : Bool?
The j option requests acknowledgment from MongoDB that the write operation has been written to the on-disk journal.
-
#j=(j : Bool?)
The j option requests acknowledgment from MongoDB that the write operation has been written to the on-disk journal.
-
#to_bson(bson = BSON.new)
Converts to a BSON representation.
- #unacknowledged?
-
#w : Int32 | String | Nil
The w option requests acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags.
-
#w=(w : Int32 | String | Nil)
The w option requests acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags.
- #w_timeout : Int64?
- #w_timeout=(w_timeout : Int64?)
Constructor Detail
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)
Create a WriteConcern instance.
Class Method Detail
Instance Method Detail
The j option requests acknowledgment from MongoDB that the write operation has been written to the on-disk journal.
The j option requests acknowledgment from MongoDB that the write operation has been written to the on-disk journal.
Converts to a BSON representation.
user = User.new name: "John"
bson = user.to_bson
The w option requests acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags.
The w option requests acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags.