struct

Mongo::WriteConcern

Inherits BSON::Serializable / Struct / Value / Object

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

Constructors

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)
Source
new(j : Bool | Nil = nil, w : Int32 | Nil | String | Nil = nil, w_timeout : Int64 | Nil = nil)

Create a WriteConcern instance.

Source

Class methods

from_bson(bson : BSON)

NOTE: See self.new.

Source

Instance methods

j

The j option requests acknowledgment from MongoDB that the write operation has been written to the on-disk journal.

Source
j=(j : Bool | Nil)

The j option requests acknowledgment from MongoDB that the write operation has been written to the on-disk journal.

Source
to_bson(bson = BSON.new)

Converts to a BSON representation.

user = User.new name: "John"
bson = user.to_bson
Source
unacknowledged?
Source
w

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.

Source
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.

Source
w_timeout

This option specifies a time limit, in milliseconds, for the write concern. wtimeout is only applicable for w values greater than 1.

Source
w_timeout=(w_timeout : Int64 | Nil)

This option specifies a time limit, in milliseconds, for the write concern. wtimeout is only applicable for w values greater than 1.

Source