<?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="bson_iter_document">
  <info>
    <link type="guide" xref="bson_iter_t" group="function"/>
  </info>
  <title>bson_iter_document()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[
#define BSON_ITER_HOLDS_DOCUMENT(iter) \
   (bson_iter_type ((iter)) == BSON_TYPE_DOCUMENT)

void
bson_iter_document (const bson_iter_t *iter,
                    uint32_t          *document_len,
                    const uint8_t    **document);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>iter</p></td><td><p>A <link xref="bson_iter_t">bson_iter_t</link>.</p></td></tr>
      <tr><td><p>document_len</p></td><td><p>A location for the length of the document in bytes.</p></td></tr>
      <tr><td><p>document</p></td><td><p>A location for the document buffer.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>The <code>bson_iter_document()</code> function shall retrieve the raw buffer of a sub-document from <code>iter</code>. <code>iter</code> <em>MUST</em> be on an element that is of type BSON_TYPE_DOCUMENT. This can be verified with <link xref="bson_iter_type">bson_iter_type()</link> or the <code>BSON_ITER_HOLDS_DOCUMENT()</code> macro.</p>
  </section>

</page>
