.\" Man page generated from reStructuredText. . .TH "MONGOC_WRITE_CONCERN_T" "3" "Jun 04, 2021" "1.17.6" "libmongoc" .SH NAME mongoc_write_concern_t \- mongoc_write_concern_t . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .sp Write Concern abstraction .SH SYNOPSIS .sp \fBmongoc_write_concern_t\fP tells the driver what level of acknowledgement to await from the server. The default, MONGOC_WRITE_CONCERN_W_DEFAULT, is right for the great majority of applications. .sp You can specify a write concern on connection objects, database objects, collection objects, or per\-operation. Data\-modifying operations typically use the write concern of the object they operate on, and check the server response for a write concern error or write concern timeout. For example, \fBmongoc_collection_drop_index\fP uses the collection\(aqs write concern, and a write concern error or timeout in the response is considered a failure. .sp Exceptions to this principle are the generic command functions: .INDENT 0.0 .IP \(bu 2 \fBmongoc_client_command\fP .IP \(bu 2 \fBmongoc_client_command_simple\fP .IP \(bu 2 \fBmongoc_database_command\fP .IP \(bu 2 \fBmongoc_database_command_simple\fP .IP \(bu 2 \fBmongoc_collection_command\fP .IP \(bu 2 \fBmongoc_collection_command_simple\fP .UNINDENT .sp These generic command functions do not automatically apply a write concern, and they do not check the server response for a write concern error or write concern timeout. .sp See \fI\%Write Concern\fP on the MongoDB website for more information. .SH WRITE CONCERN LEVELS .sp Set the write concern level with \fBmongoc_write_concern_set_w\fP\&. .TS center; |l|l|. _ T{ MONGOC_WRITE_CONCERN_W_DEFAULT (1) T} T{ By default, writes block awaiting acknowledgement from MongoDB. Acknowledged write concern allows clients to catch network, duplicate key, and other errors. T} _ T{ MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED (0) T} T{ With this 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. T} _ T{ MONGOC_WRITE_CONCERN_W_MAJORITY (majority) T} T{ Block until a write has been propagated to a majority of the nodes in the replica set. T} _ T{ n T} T{ Block until a write has been propagated to at least \fBn\fP nodes in the replica set. T} _ .TE .SH DEPRECATIONS .sp The write concern \fBMONGOC_WRITE_CONCERN_W_ERRORS_IGNORED\fP (value \-1) is a deprecated synonym for \fBMONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED\fP (value 0), and will be removed in the next major release. .sp \fBmongoc_write_concern_set_fsync\fP is deprecated. .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .