WriteConcern class

WriteConcern control the acknowledgment of write operations with various paramaters.

Constructors

WriteConcern({dynamic w, int? wtimeout, bool fsync = true, bool j = true, String? provenance})
Creates a WriteConcern object
const
WriteConcern.fromMap(Map<String, Object> writeConcernMap)

Properties

command Map<String, dynamic>
Gets the getlasterror command for this write concern.
no setter
fsync bool
Enables or disable fsync() operation before acknowledgement of the requested write operation. If true, wait for mongod instance to write data to disk before returning.
final
hashCode int
The hash code for this object.
no setterinherited
j bool
Enables or disable journaling of the requested write operation before acknowledgement. If true, wait for mongod instance to write data to the on-disk journal before returning.
final
provenance String?
A string value indicating where the write concern originated (known as write concern provenance). The following table shows the possible values for this field and their significance:
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
w → dynamic
Denotes the Write Concern level that takes the following values (int or String):
final
wtimeout int?
Specifies a timeout for this Write Concern in milliseconds, or infinite if equal to 0.
final

Methods

asMap(ServerStatus serverStatus) Map<String, Object>
To be used starting with journaled engines (Only Wired Tiger, Journal Only) For inMemoryEngine the J option is ignored
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

ACKNOWLEDGED → const WriteConcern
acknowledged → const WriteConcern
Write operations that use this write concern will wait for acknowledgement from the primary server before returning. Exceptions are raised for network issues, and server errors.
ERRORS_IGNORED → const WriteConcern
No exceptions are raised, even for network issues.
FSYNCED → const WriteConcern
Exceptions are raised for network issues, and server errors; the write operation waits for the server to flush the data to disk.
JOURNALED → const WriteConcern
journaled → const WriteConcern
Exceptions are raised for network issues, and server errors; the write operation waits for the server to group commit to the journal file on disk.
MAJORITY → const WriteConcern
majority → const WriteConcern
Exceptions are raised for network issues, and server errors; waits on a majority of servers for the write operation.
REPLICA_ACKNOWLEDGED → const WriteConcern
replicaAcknowledged → const WriteConcern
Exceptions are raised for network issues, and server errors; waits for at least 2 servers for the write operation.
UNACKNOWLEDGED → const WriteConcern
unacknowledged → const WriteConcern
Write operations that use this write concern will return as soon as the message is written to the socket. Exceptions are raised for network issues, but not server errors.