final class WriteConcern implements Serializable, 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.

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

PackedArray
bsonSerialize()

Returns an object for BSON serialization

string|null
serialize()

Serialize a WriteConcern

void
unserialize(string $data)

Unserialize a WriteConcern

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
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 PackedArray bsonSerialize()

Since: 1.2.0

Returns an object for BSON serialization

Return Value

PackedArray

Exceptions

InvalidArgumentException

final string|null serialize()

Since: 1.7.0

Serialize a WriteConcern

Return Value

string|null

The string representation of the object or null

Exceptions

InvalidArgumentException

final void unserialize(string $data)

Since: 1.7.0

Unserialize a WriteConcern

Parameters

string $data

The string representation of the object.

Return Value

void

Exceptions

InvalidArgumentException
UnexpectedValueException

final bool isDefault()

No description

Return Value

bool