<?xml version="1.0"?>
<page id="mongoc_write_concern_t"
      type="guide"
      style="class"
      xmlns="http://projectmallard.org/1.0/"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/">
  <info>
    <link type="guide" xref="index#api-reference" />
  </info>
  <title>mongoc_write_concern_t</title>
  <subtitle>Write Concern abstraction</subtitle>
  <section id="description">
    <title>Synopsis</title>
    <p><code>mongoc_write_concern_t</code> tells the driver what level of acknowledgment to await from the server. The default, MONGOC_WRITE_CONCERN_W_DEFAULT, is right for the great majority of applications.</p>
    <p>You can specify a write concern on connection objects, database objects, collection objects, or per-operation.</p>
    <p>See <link href="http://docs.mongodb.org/manual/core/write-concern/">Write Concern</link> on the MongoDB website for more information.</p>
  </section>

  <section id="levels">
    <title>Write Concern Levels</title>
    <table>
      <title>Network Related</title>
      <tr>
        <td><p>MONGOC_WRITE_CONCERN_W_DEFAULT (1)</p></td>
        <td><p>By default, writes block awaiting acknowledgment from MongoDB. Acknowledged write concern allows clients to catch network, duplicate key, and other errors.</p></td>
      </tr>
      <tr>
        <td><p>MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED (0)</p></td>
        <td><p>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.</p></td>
      </tr>
      <tr>
        <td><p>MONGOC_WRITE_CONCERN_W_MAJORITY (majority)</p></td>
        <td><p>Block until a write has been propagated to a majority of the nodes in the replica set.</p></td>
      </tr>
      <tr>
        <td><p>n</p></td>
        <td><p>Block until a write has been propagated to at least <code>n</code> nodes in the replica set.</p></td>
      </tr>
    </table>
    <table>
      <title>Node Persistence</title>
      <tr>
        <td><p>journal</p></td>
        <td><p>Block until the node receiving the write has committed the journal.</p></td>
      </tr>
    </table>
  </section>

  <section id="deprecations">
    <title>Deprecation</title>
    <p>The write concern <code>MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED</code> (value -1) is a deprecated synonym for <code>MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED</code> (value 0), and will be removed in the next major release.</p>
  </section>

  <links type="topic" groups="function" style="2column">
    <title>Functions</title>
  </links>
</page>
