<?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_collection_ensure_index">


  <info>
    <link type="guide" xref="mongoc_collection_t" group="function"/>
  </info>
  <title>mongoc_collection_ensure_index()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[bool
mongoc_collection_ensure_index (mongoc_collection_t      *collection,
                                const bson_t             *keys,
                                const mongoc_index_opt_t *opt,
                                bson_error_t             *error)
   BSON_GNUC_DEPRECATED_FOR (mongoc_collection_create_index);
]]></code></synopsis>
  </section>


  <section id="deprecated">
    <title>Deprecated</title>
    <note style="warning"><p>This function is deprecated and should not be used in new code.</p></note>
    <p>Please use <link xref="mongoc_collection_create_index">mongoc_collection_create_index()</link> instead.</p>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>collection</p></td><td><p>A <link xref="mongoc_collection_t">mongoc_collection_t</link>.</p></td></tr>
      <tr><td><p>keys</p></td><td><p>A bson_t.</p></td></tr>
      <tr><td><p>opt</p></td><td><p>A mongoc_index_opt_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>

</page>
