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

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[bool
bson_iter_as_bool (const bson_iter_t *iter);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>iter</p></td><td><p>A <code xref="bson_iter_t">bson_iter_t</code>.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>Fetches the current field as if it were a boolean.</p>
    <p><code>bson_iter_as_bool()</code> currently knows how to determine a boolean value from the following types:</p>

    <list>
      <item><p>BSON_TYPE_BOOL</p></item>
      <item><p>BSON_TYPE_DOUBLE</p></item>
      <item><p>BSON_TYPE_INT32</p></item>
      <item><p>BSON_TYPE_INT64</p></item>
      <item><p>BSON_TYPE_NULL</p></item>
      <item><p>BSON_TYPE_UNDEFINED</p></item>
      <item><p>BSON_TYPE_UTF8</p></item>
    </list>

    <p>BSON_TYPE_UTF8 will always equate to <code>true</code>.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>true if the field equates to non-zero.</p>
  </section>
</page>
