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


  <info>
    <link type="guide" xref="mongoc_database_t" group="function"/>
  </info>
  <title>mongoc_database_add_user()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[bool
mongoc_database_add_user (mongoc_database_t *database,
                          const char        *username,
                          const char        *password,
                          const bson_t      *roles,
                          const bson_t      *custom_data,
                          bson_error_t      *error);
]]></code></synopsis>
  </section>


  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>database</p></td><td><p>A <code xref="mongoc_database_t">mongoc_database_t</code>.</p></td></tr>
      <tr><td><p>username</p></td><td><p>The name of the user.</p></td></tr>
      <tr><td><p>password</p></td><td><p>The cleartext password for the user.</p></td></tr>
      <tr><td><p>roles</p></td><td><p>An optional <code xref="bson:bson_t">bson_t</code> for roles.</p></td></tr>
      <tr><td><p>custom_data</p></td><td><p>A optional <code xref="bson:bson_t">bson_t</code> for extra data.</p></td></tr>
      <tr><td><p>error</p></td><td><p>A location for a <code xref="bson:bson_error_t">bson_error_t</code> or <code>NULL</code>.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <p>This function shall create a new user with access to <code>database</code>.</p>
    <p>This function handles the difference between MongoDB <code>2.4</code> and <code>2.6</code>.</p>
  </section>

  <section id="errors">
    <title>Errors</title>
    <p>Errors are returned through the <code>error</code> parameter and can include socket or other server side failures.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>This function shall return <code>true</code> if the user was successfully added. In the event of an error, it returns <code>false</code> and <code>error</code> is set.</p>
  </section>


</page>
