mongoc_write_concern_t
Write Concern abstraction
Synopsis
mongoc_write_concern_t provides an abstraction on top of the MongoDB connection write concern. It allows for hinting to the driver how durable writes should be, both in replication as well as on a per node basis.
You can specify a read preference mode on connection objects, database objects, collection objects, or per-operation.
Write Concern Levels
Network Related
MONGOC_WRITE_CONCERN_W_DEFAULT (1) |
With a receipt acknowledged write concern, the mongod confirms the receipt of the write operation. Acknowledged write concern allows clients to catch network, duplicate key, and other errors. |
MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED (-1) |
With an errors ignored write concern, MongoDB does not acknowledge write operations. With this level of write concern, the client cannot detect failed write operations. These errors include connection errors and mongod exceptions such as duplicate key exceptions for unique indexes. Although the errors ignored write concern provides fast performance, this performance gain comes at the cost of significant risks for data persistence and durability. |
MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED (0) |
With an unacknowledged write concern, MongoDB does not acknowledge the receipt of write operation. Unacknowledged is similar to errors ignored; however, mongoc attempts to receive and handle network errors when possible. |
MONGOC_WRITE_CONCERN_W_MAJORITY (majority) |
Require that a write has been propagated to a majority of the nodes in the replica set. |
n |
Require that a write has been propagated to at least n nodes in the replica set. |
Node Persistence
fsync |
Force a full fsync() on the node receiving the write. |
journal |
Force a flush to the journal on the node receiving the write. |