<?xml version="1.0"?>

<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="mongoc_bulk_operation_execute">


  <info>
    <link type="guide" xref="mongoc_bulk_operation_t" group="function"/>
  </info>
  <title>mongoc_bulk_operation_execute()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[uint32_t
mongoc_bulk_operation_execute (mongoc_bulk_operation_t *bulk,
                               bson_t                  *reply,
                               bson_error_t            *error);
]]></code></synopsis>
    <p>This function executes all operations queued into the bulk operation. If <code>ordered</code> was specified to <link xref="mongoc_collection_create_bulk_operation">mongoc_collection_create_bulk_operation()</link>, then forward progress will be stopped upon the first error.</p>

    <p>It is only valid to call <link xref="mongoc_bulk_operation_execute">mongoc_bulk_operation_execute()</link> once. The <code>mongoc_bulk_operation_t</code> must be destroyed afterwards.</p>

    <note style="warning"><p><code>reply</code> is always initialized, even upon failure. Callers <em>must</em> call <link xref="bson_destroy">bson_destroy()</link> to release this potential allocation.</p></note>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>bulk</p></td><td><p>A <link xref="mongoc_bulk_operation_t">mongoc_bulk_operation_t</link>.</p></td></tr>
      <tr><td><p>reply</p></td><td><p>A bson_t.</p></td></tr>
      <tr><td><p>error</p></td><td><p>An optional location for a <link xref="bson_error_t">bson_error_t</link> or <code>NULL</code>.</p></td></tr>
    </table>
  </section>

  <section id="errors">
    <title>Errors</title>
    <p>Errors are propagated via the <code>error</code> parameter.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>A non-zero <code>hint</code> of the peer node on success, otherwise <code>0</code> and <code>error</code> is set.</p>
  </section>


</page>
