final class WriteConcern implements Serializable (View source)

WriteConcern controls the acknowledgment of a write operation, specifies the level of write guarantee for Replica Sets.

Constants

MAJORITY

Majority of all the members in the set; arbiters, non-voting members, passive members, hidden members and delayed members are all included in the definition of majority write concern.

Properties

string|int|null Since: 2.3.0
$w
bool|null Since: 2.3.0
$j
int Since: 2.3.0
$wtimeout

Methods

__construct(string|int $w, int|null $wtimeout = null, bool|null $journal = null)

Construct immutable WriteConcern

static 
__set_state(array $properties)

No description

bool|null
getJournal()

Returns the WriteConcern's "journal" option

string|int|null
getW()

Returns the WriteConcern's "w" option

int
getWtimeout()

Returns the WriteConcern's "wtimeout" option

bsonSerialize()

Returns an object for BSON serialization

bool
isDefault()

No description

Details

final __construct(string|int $w, int|null $wtimeout = null, bool|null $journal = null)

Construct immutable WriteConcern

Parameters

string|int $w

Write concern Value Description 1 Requests acknowledgement that the write operation has propagated to the standalone mongod or the primary in a replica set. This is the default write concern for MongoDB. 0 Requests no acknowledgment of the write operation. However, this may return information about socket exceptions and networking errors to the application. <integer greater than 1> Numbers greater than 1 are valid only for replica sets to request acknowledgement from specified number of members, including the primary. MongoDB\Driver\WriteConcern::MAJORITY Requests acknowledgment that write operations have propagated to the majority of voting nodes, including the primary, and have been written to the on-disk journal for these nodes. Prior to MongoDB 3.0, this refers to the majority of replica set members (not just voting nodes). string A string value is interpereted as a tag set. Requests acknowledgement that the write operations have propagated to a replica set member with the specified tag.

int|null $wtimeout

How long to wait (in milliseconds) for secondaries before failing.

bool|null $journal

Wait until mongod has applied the write to the journal.

Exceptions

InvalidArgumentException

static __set_state(array $properties)

No description

Parameters

array $properties

final bool|null getJournal()

Returns the WriteConcern's "journal" option

Return Value

bool|null

final string|int|null getW()

Returns the WriteConcern's "w" option

Return Value

string|int|null

final int getWtimeout()

Returns the WriteConcern's "wtimeout" option

Return Value

int

final array|stdClass|Document|PackedArray bsonSerialize()

Since: 1.2.0

Returns an object for BSON serialization

Return Value

array|stdClass|Document|PackedArray

Exceptions

InvalidArgumentException

final bool isDefault()

No description

Return Value

bool