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 = nil, w : Int32 | Nil | String | Nil = nil, w_timeout : Int64 | Nil = nil)
Create a WriteConcern instance.
Class Method Summary
-
.from_bson(bson : BSON)
NOTE See
self.new
.
Instance Method Summary
-
#j : Bool | Nil
The j option requests acknowledgment from MongoDB that the write operation has been written to the on-disk journal.
-
#j=(j : Bool | Nil)
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 | Nil
This option specifies a time limit, in milliseconds, for the write concern.
-
#w_timeout=(w_timeout : Int64 | Nil)
This option specifies a time limit, in milliseconds, for the write concern.
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.
This option specifies a time limit, in milliseconds, for the write concern. wtimeout is only applicable for w values greater than 1.
This option specifies a time limit, in milliseconds, for the write concern. wtimeout is only applicable for w values greater than 1.