<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mongodb-driver-manager.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'mongodb-driver-manager.construct.php',
    1 => 'MongoDB\\Driver\\Manager::__construct',
    2 => 'Create new MongoDB Manager',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-driver-manager.php',
    1 => 'MongoDB\\Driver\\Manager',
  ),
  'prev' => 
  array (
    0 => 'mongodb-driver-manager.addsubscriber.php',
    1 => 'MongoDB\\Driver\\Manager::addSubscriber',
  ),
  'next' => 
  array (
    0 => 'mongodb-driver-manager.createclientencryption.php',
    1 => 'MongoDB\\Driver\\Manager::createClientEncryption',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/mongodb/driver/manager/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-driver-manager.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\Manager::__construct</h1>
  <p class="verinfo">(mongodb &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\Manager::__construct</span> &mdash; <span class="dc-title">Create new MongoDB Manager</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-manager.construct-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><strong>MongoDB\Driver\Manager::__construct</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$uri</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.array.php" class="type array">array</a></span></span> <code class="parameter">$uriOptions</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.array.php" class="type array">array</a></span></span> <code class="parameter">$driverOptions</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>)</div>

  <p class="simpara">
   Constructs a new <span class="classname"><a href="class.mongodb-driver-manager.php" class="classname">MongoDB\Driver\Manager</a></span> object with the specified options.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <span class="simpara">
    Per the <a href="https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#single-threaded-client-construction" class="link external">&raquo;&nbsp;Server Discovery and Monitoring Specification</a>,
    this constructor performs no I/O. Connections will be initialized on demand,
    when the first operation is executed.
   </span>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <span class="simpara">
    When specifying any SSL or TLS URI options via the connection string or
    <code class="parameter">uriOptions</code> parameter, the extension will implicitly
    enable TLS for its connections. To avoid this, either explicitly disable the
    <code class="literal">tls</code> option or don&#039;t specify any TLS options.
   </span>
  </p></blockquote>
  
   <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
    <span class="simpara">
     Auf Unix-Plattformen reagiert die Erweiterung empfindlich auf
     Skripte, die den Systemaufruf fork() verwenden, ohne auch exec()
     aufzurufen. Es wird davon abgeraten,
     <span class="classname"><a href="class.mongodb-driver-manager.php" class="classname">MongoDB\Driver\Manager</a></span>-Instanzen in einem
     geforkten Kindprozess wiederzuverwenden.
    </span>
   </p></blockquote>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-driver-manager.construct-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt id="mongodb-driver-manager.construct-uri"><code class="parameter">uri</code></dt>
    <dd>
     <span class="simpara">A <a href="https://www.mongodb.com/docs/manual/reference/connection-string/" class="link external">&raquo;&nbsp;mongodb://</a> connection URI:</span>
     <div class="example-contents">
<div class="txtcode"><pre class="txtcode">mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[defaultAuthDb][?options]]</pre>
</div>
     </div>

     <span class="simpara">
      Defaults to <code class="literal">&quot;mongodb://127.0.0.1:27017&quot;</code> if unspecified.
     </span>
     <span class="simpara">
      For details on supported URI options, see
      <a href="https://www.mongodb.com/docs/manual/reference/connection-string/#connections-connection-options" class="link external">&raquo;&nbsp;Connection String Options</a>
      in the MongoDB manual.
      <a href="https://www.mongodb.com/docs/manual/reference/connection-string/#connection-pool-options" class="link external">&raquo;&nbsp;Connection pool options</a>
      are not supported, as the extension does not implement connection pools.
     </span>
     <span class="simpara">
      The <code class="parameter">uri</code> is a URL, hence any special characters in
      its components need to be URL encoded according to
      <a href="https://datatracker.ietf.org/doc/html/rfc3986" class="link external">&raquo;&nbsp;RFC 3986</a>. This is particularly
      relevant to the username and password, which can often include special
      characters such as <code class="literal">@</code>, <code class="literal">:</code>, or
      <code class="literal">%</code>. When connecting via a Unix domain socket, the socket
      path may contain special characters such as slashes and must be encoded.
      The <span class="function"><a href="function.rawurlencode.php" class="function">rawurlencode()</a></span> function may be used to encode
      constituent parts of the URI.
     </span>
     <span class="simpara">
      The <code class="literal">defaultAuthDb</code> component may be used to specify the
      database name associated with the user&#039;s credentials; however the
      <code class="literal">authSource</code> URI option will take priority if specified.
      If neither <code class="literal">defaultAuthDb</code> nor
      <code class="literal">authSource</code> are specified, the <code class="literal">admin</code>
      database will be used by default. The <code class="literal">defaultAuthDb</code>
      component has no effect in the absence of user credentials.
     </span>
    </dd>
   
   
    <dt id="mongodb-driver-manager.construct-urioptions"><code class="parameter">uriOptions</code></dt>
    <dd>
     <span class="simpara">
      Additional
      <a href="https://www.mongodb.com/docs/manual/reference/connection-string/#connections-connection-options" class="link external">&raquo;&nbsp;connection string options</a>,
      which will overwrite any options with the same name in the
      <code class="parameter">uri</code> parameter.
     </span>
     <p class="para">
      <table class="doctable table">
       <caption><strong>uriOptions</strong></caption>
       
        <thead>
         <tr>
          <th>Option</th>
          <th>Type</th>
          <th>Description</th>
         </tr>

        </thead>

        <tbody class="tbody">
         <tr>
          <td>appname</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            MongoDB 3.4+ has the ability to annotate connections with metadata
            provided by the connecting client. This metadata is included in the
            server&#039;s logs upon establishing a connection and also recorded in
            slow query logs when database profiling is enabled.
           </span>
           <span class="simpara">
            This option may be used to specify an application name, which will
            be included in the metadata. The value cannot exceed 128 characters
            in length.
           </span>
          </td>
         </tr>

         <tr>
          <td>authMechanism</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            The authentication mechanism that MongoDB will use to authenticate
            the connection. For additional details and a list of supported
            values, see
            <a href="https://www.mongodb.com/docs/manual/reference/connection-string/#urioption.authMechanism" class="link external">&raquo;&nbsp;Authentication Options</a>
            in the MongoDB manual.
           </span>
          </td>
         </tr>

         <tr>
          <td>authMechanismProperties</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <span class="simpara">
            Properties for the selected authentication mechanism. For additional
            details and a list of supported properties, see the
            <a href="https://github.com/mongodb/specifications/blob/master/source/auth/auth.rst#auth-related-options" class="link external">&raquo;&nbsp;Driver Authentication Specification</a>.
           </span>
           <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
            <span class="simpara">
             When not specified in the URI string, this option is expressed as
             an array of key/value pairs. The keys and values in this array
             should be strings.
            </span>
           </p></blockquote>
          </td>
         </tr>

         <tr>
          <td>authSource</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            The database name associated with the user&#039;s credentials. Defaults
            to the database component of the connection URI, or the
            <code class="literal">admin</code> database if both are unspecified.
           </span>
           <span class="simpara">
            For authentication mechanisms that delegate credential storage to
            other services (e.g. GSSAPI), this should be
            <code class="literal">&quot;$external&quot;</code>.
           </span>
          </td>
         </tr>

         <tr>
          <td>compressors</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            A prioritized, comma-delimited list of compressors that the client
            wants to use. Messages are only compressed if the client and server
            share any compressors in common, and the compressor used in each
            direction will depend on the individual configuration of the server
            or driver. See the
            <a href="https://github.com/mongodb/specifications/blob/master/source/compression/OP_COMPRESSED.rst#compressors" class="link external">&raquo;&nbsp;Driver Compression Specification</a>
            for more information.
           </span>
          </td>
         </tr>

         <tr id="mongodb-driver-manager.construct-urioptions.connecttimeoutms">
          <td>connectTimeoutMS</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            The time in milliseconds to attempt a connection before timing out.
            Defaults to 10,000 milliseconds.
           </span>
          </td>
         </tr>

         <tr>
          <td>directConnection</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            This option can be used to control replica set discovery behavior
            when only a single host is provided in the connection string. By
            default, providing a single member in the connection string will
            establish a direct connection or discover additional members
            depending on whether the <code class="literal">&quot;replicaSet&quot;</code> URI option
            is omitted or present, respectively. Specify <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> to force
            discovery to occur (if <code class="literal">&quot;replicaSet&quot;</code> is omitted)
            or specify <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> to force a direct connection (if
            <code class="literal">&quot;replicaSet&quot;</code> is present).
           </span>
          </td>
         </tr>

         <tr>
          <td>heartbeatFrequencyMS</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            Specifies the interval in milliseconds between the driver&#039;s checks
            of the MongoDB topology, counted from the end of the previous check
            until the beginning of the next one. Defaults to 60,000
            milliseconds.
           </span>
           <span class="simpara">
            Per the
            <a href="https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#heartbeatfrequencyms" class="link external">&raquo;&nbsp;Server Discovery and Monitoring Specification</a>,
            this value cannot be less than 500 milliseconds.
           </span>
          </td>
         </tr>

         <tr>
          <td>journal</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            Corresponds to the default write concern&#039;s
            <code class="parameter">journal</code> parameter. If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, writes will
            require acknowledgement from MongoDB that the operation has been
            written to the journal. For details, see
            <span class="classname"><a href="class.mongodb-driver-writeconcern.php" class="classname">MongoDB\Driver\WriteConcern</a></span>.
           </span>
          </td>
         </tr>

         <tr>
          <td>loadBalanced</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            Specifies whether the driver is connecting to a MongoDB cluster
            through a load balancer. If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, the driver may only connect to a
            single host (specified by either the connection string or SRV
            lookup), the <code class="literal">&quot;directConnection&quot;</code> URI option
            cannot be <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, and the <code class="literal">&quot;replicaSet&quot;</code> URI option
            must be omitted. Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
          </td>
         </tr>

         <tr>
          <td>localThresholdMS</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            The size in milliseconds of the latency window for selecting among
            multiple suitable MongoDB instances while resolving a read
            preference. Defaults to 15 milliseconds.
           </span>
          </td>
         </tr>

         <tr>
          <td>maxStalenessSeconds</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            Corresponds to the read preference&#039;s
            <code class="literal">&quot;maxStalenessSeconds&quot;</code>. Specifies, in seconds, how
            stale a secondary can be before the client stops using it for read
            operations. By default, there is no maximum staleness and clients
            will not consider a secondary’s lag when choosing where to direct a
            read operation. For details, see
            <span class="classname"><a href="class.mongodb-driver-readpreference.php" class="classname">MongoDB\Driver\ReadPreference</a></span>.
           </span>
           <span class="simpara">
            If specified, the max staleness must be a signed 32-bit integer
            greater than or equal to
            <strong><code><a href="class.mongodb-driver-readpreference.php#mongodb-driver-readpreference.constants.smallest-max-staleness-seconds">MongoDB\Driver\ReadPreference::SMALLEST_MAX_STALENESS_SECONDS</a></code></strong>
            (i.e. 90 seconds).
           </span>
          </td>
         </tr>

         <tr>
          <td>password</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           The password for the user being authenticated. This option is useful
           if the password contains special characters, which would otherwise
           need to be URL encoded for the connection URI.
          </td>
         </tr>

         <tr>
          <td>readConcernLevel</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           Corresponds to the read concern&#039;s <code class="parameter">level</code>
           parameter. Specifies the level of read isolation. For details, see
           <span class="classname"><a href="class.mongodb-driver-readconcern.php" class="classname">MongoDB\Driver\ReadConcern</a></span>.
          </td>
         </tr>

         <tr>
          <td>readPreference</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            Corresponds to the read preference&#039;s <code class="parameter">mode</code>
            parameter. Defaults to <code class="literal">&quot;primary&quot;</code>. For details,
            see <span class="classname"><a href="class.mongodb-driver-readpreference.php" class="classname">MongoDB\Driver\ReadPreference</a></span>.
           </span>
          </td>
         </tr>

         <tr>
          <td>readPreferenceTags</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <span class="simpara">
            Corresponds to the read preference&#039;s <code class="parameter">tagSets</code>
            parameter. Tag sets allow you to target read operations to specific
            members of a replica set. For details, see
            <span class="classname"><a href="class.mongodb-driver-readpreference.php" class="classname">MongoDB\Driver\ReadPreference</a></span>.
           </span>
           <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
            <span class="simpara">
             When not specified in the URI string, this option is expressed as
             an array consistent with the format expected by
             <span class="function"><a href="mongodb-driver-readpreference.construct.php" class="function">MongoDB\Driver\ReadPreference::__construct()</a></span>.
            </span>
           </p></blockquote>
          </td>
         </tr>

         <tr>
          <td>replicaSet</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            Specifies the name of the replica set.
           </span>
          </td>
         </tr>

         <tr>
          <td>retryReads</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            Specifies whether or not the driver should automatically retry
            certain read operations that fail due to transient network errors
            or replica set elections. This functionality requires MongoDB 3.6+.
            Defaults to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
           </span>
           <span class="simpara">
            See the
            <a href="https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.rst" class="link external">&raquo;&nbsp;Retryable Reads Specification</a>
            for more information.
           </span>
          </td>
         </tr>

         <tr>
          <td>retryWrites</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            Specifies whether or not the driver should automatically retry
            certain write operations that fail due to transient network errors
            or replica set elections. This functionality requires MongoDB 3.6+.
            Defaults to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
           </span>
           <span class="simpara">
            See
            <a href="https://www.mongodb.com/docs/manual/core/retryable-writes/" class="link external">&raquo;&nbsp;Retryable Writes</a>
            in the MongoDB manual for more information.
           </span>
          </td>
         </tr>

         <tr id="mongodb-driver-manager.construct-urioptions.serverselectiontimeoutms">
          <td>serverSelectionTimeoutMS</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            Specifies how long in milliseconds to block for server selection
            before throwing an exception. Defaults to 30,000 milliseconds.
           </span>
          </td>
         </tr>

         <tr>
          <td>serverSelectionTryOnce</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            When <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, instructs the driver to scan the MongoDB deployment
            exactly once after server selection fails and then either select a
            server or raise an error. When <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, the driver blocks and
            searches for a server up to the
            <code class="literal">&quot;serverSelectionTimeoutMS&quot;</code> value. Defaults to
            <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
           </span>
          </td>
         </tr>

         <tr>
          <td>socketCheckIntervalMS</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            If a socket has not been used recently, the driver must check it via
            a <code class="literal">hello</code> command before using it for any
            operation. Defaults to 5,000 milliseconds.
           </span>
          </td>
         </tr>

         <tr>
          <td>socketTimeoutMS</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            The time in milliseconds to attempt a send or receive on a socket
            before timing out. Defaults to 300,000 milliseconds (i.e. five
            minutes).
           </span>
          </td>
         </tr>

         <tr>
          <td>srvMaxHosts</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            The maximum number of SRV results to randomly select when initially
            populating the seedlist or, during SRV polling, adding new hosts to
            the topology. Defaults to <code class="literal">0</code> (i.e. no maximum).
           </span>
          </td>
         </tr>

         <tr>
          <td>srvServiceName</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            The service name to use for SRV lookup in initial DNS seedlist
            discovery and SRV polling. Defaults to <code class="literal">&quot;mongodb&quot;</code>.
           </span>
          </td>
         </tr>

         <tr>
          <td>tls</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            Initiates the connection with TLS/SSL if <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>. Defaults to
            <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
          </td>
         </tr>

         <tr>
          <td>tlsAllowInvalidCertificates</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            Specifies whether or not the driver should error when the server&#039;s
            TLS certificate is invalid. Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
           <div class="warning"><strong class="warning">Warnung</strong>
            <p class="simpara">
             Disabling certificate validation creates a vulnerability.
            </p>
           </div>
          </td>
         </tr>

         <tr>
          <td>tlsAllowInvalidHostnames</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            Specifies whether or not the driver should error when there is a
            mismatch between the server&#039;s hostname and the hostname specified by
            the TLS certificate. Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
           <div class="warning"><strong class="warning">Warnung</strong>
            <p class="simpara">
             Disabling certificate validation creates a vulnerability. Allowing
             invalid hostnames may expose the driver to a
             <a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack" class="link external">&raquo;&nbsp;man-in-the-middle attack</a>.
            </p>
           </div>
          </td>
         </tr>

         <tr>
          <td>tlsCAFile</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            Path to file with either a single or bundle of certificate
            authorities to be considered trusted when making a TLS connection.
            The system certificate store will be used by default.
           </span>
          </td>
         </tr>

         <tr>
          <td>tlsCertificateKeyFile</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            Path to the client certificate file or the client private key file;
            in the case that they both are needed, the files should be
            concatenated.
           </span>
          </td>
         </tr>

         <tr>
          <td>tlsCertificateKeyFilePassword</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            Password to decrypt the client private key (i.e.
            <code class="literal">&quot;tlsCertificateKeyFile&quot;</code> URI option) to be used
            for TLS connections.
           </span>
          </td>
         </tr>

         <tr>
          <td>tlsDisableCertificateRevocationCheck</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, the driver will not attempt to check certificate
            revocation status (e.g. OCSP, CRL). Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
          </td>
         </tr>

         <tr>
          <td>tlsDisableOCSPEndpointCheck</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, the driver will not attempt to contact an OCSP responder
            endpoint if needed (i.e. an OCSP response is not stapled). Defaults
            to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
          </td>
         </tr>

         <tr>
          <td>tlsInsecure</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            Relax TLS constraints as much as possible. Specifying <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> for
            this option has the same effect as specifying <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> for both the
            <code class="literal">&quot;tlsAllowInvalidCertificates&quot;</code> and
            <code class="literal">&quot;tlsAllowInvalidHostnames&quot;</code> URI options. Defaults
            to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
           <div class="warning"><strong class="warning">Warnung</strong>
            <p class="simpara">
             Disabling certificate validation creates a vulnerability. Allowing
             invalid hostnames may expose the driver to a
             <a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack" class="link external">&raquo;&nbsp;man-in-the-middle attack</a>.
            </p>
           </div>
          </td>
         </tr>

         <tr>
          <td>username</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           The username for the user being authenticated. This option is useful
           if the username contains special characters, which would otherwise
           need to be URL encoded for the connection URI.
          </td>
         </tr>

         <tr>
          <td>w</td>
          <td><span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span></td>
          <td>
           <span class="simpara">
            Corresponds to the default write concern&#039;s <code class="parameter">w</code>
            parameter. For details, see
            <span class="classname"><a href="class.mongodb-driver-writeconcern.php" class="classname">MongoDB\Driver\WriteConcern</a></span>.
           </span>
          </td>
         </tr>

         <tr>
          <td>wTimeoutMS</td>
          <td><span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span></td>
          <td>
           <span class="simpara">
            Corresponds to the default write concern&#039;s
            <code class="parameter">wtimeout</code> parameter. Specifies a time limit,
            in milliseconds, for the write concern. For details, see
            <span class="classname"><a href="class.mongodb-driver-writeconcern.php" class="classname">MongoDB\Driver\WriteConcern</a></span>.
           </span>
           <span class="simpara">
            If specified, <code class="literal">wTimeoutMS</code> must be a signed 32-bit
            integer greater than or equal to zero.
           </span>
          </td>
         </tr>

         <tr>
          <td>zlibCompressionLevel</td>
          <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
          <td>
           <span class="simpara">
            Specifies the compression level to use for the zlib compressor. This
            option has no effect if <code class="literal">zlib</code> is not included in
            the <code class="literal">&quot;compressors&quot;</code> URI option. See the
            <a href="https://github.com/mongodb/specifications/blob/master/source/compression/OP_COMPRESSED.rst#zlibcompressionlevel" class="link external">&raquo;&nbsp;Driver Compression Specification</a>
            for more information.
           </span>
          </td>
         </tr>

        </tbody>
       
      </table>

     </p>
    </dd>
   
   
    <dt id="mongodb-driver-manager.construct-driveroptions"><code class="parameter">driverOptions</code></dt>
    <dd>
     <p class="para">
      <table class="doctable table">
       <caption><strong>driverOptions</strong></caption>
       
        <thead>
         <tr>
          <th>Option</th>
          <th>Type</th>
          <th>Description</th>
         </tr>

        </thead>

        <tbody class="tbody">
         <tr>
          <td>autoEncryption</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <span class="simpara">
            Provides options to enable automatic client-side field level
            encryption. The list of options is described in the <a href="mongodb-driver-manager.construct.php#mongodb-driver-manager.construct-autoencryption" class="link">table below</a>.
           </span>
           <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
            <span class="simpara">
             Automatic encryption is an enterprise-only feature that only
             applies to operations on a collection. Automatic encryption is not
             supported for operations on a database or view, and operations that
             are not bypassed will result in error (see
             <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#libmongocrypt-auto-encryption-allow-list" class="link external">&raquo;&nbsp;libmongocrypt: Auto Encryption Allow-List</a>). To bypass automatic encryption
             for all operations, set <code class="literal">bypassAutoEncryption</code> to
             <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
            </span>
            <span class="simpara">
             Automatic encryption requires the authenticated user to have the
             <a href="https://www.mongodb.com/docs/manual/reference/command/listCollections/#required-access" class="link external">&raquo;&nbsp;listCollections</a>
             privilege action.
            </span>
            <span class="simpara">
             Explicit encryption/decryption and automatic decryption is a
             community feature. The driver can still automatically decrypt when
             <code class="literal">bypassAutoEncryption</code> is <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
            </span>
           </p></blockquote>
          </td>
         </tr>

         <tr>
          <td>ca_dir</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>
           <span class="simpara">
            Path to a correctly hashed certificate directory. The system
            certificate store will be used by default.
           </span>
          </td>
         </tr>

         <tr>
          <td>crl_file</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>Path to a certificate revocation list file.</td>
         </tr>

         <tr>
          <td>disableClientPersistence</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, this Manager will use a new libmongoc client, which will
            not be persisted or shared with other Manager objects. When this
            Manager object is freed, its client will be destroyed and any
            connections will be closed. Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
           <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
            <span class="simpara">
             Disabling client persistence is not generally recommended.
            </span>
           </p></blockquote>
          </td>
         </tr>

         <tr>
          <td>driver</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <span class="simpara">
            Allows a higher level library to append its own metadata to the
            server handshake. By default, the extension submits its own name,
            version, and platform (i.e. PHP version) in the handshake. Strings
            can be specified for the <code class="literal">&quot;name&quot;</code>,
            <code class="literal">&quot;version&quot;</code>, and <code class="literal">&quot;platform&quot;</code> keys
            of this array, and will be appended to the respective field(s) in
            the handshake document.
           </span>
           <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
            <span class="simpara">
             Handshake information is limited to 512 bytes. The extension will
             truncate handshake data to fit within this 512-byte string. Higher
             level libraries are encouraged to keep their own metadata concise.
            </span>
           </p></blockquote>
          </td>
         </tr>

         <tr>
          <td>serverApi</td>
          <td><span class="classname"><a href="class.mongodb-driver-serverapi.php" class="classname">MongoDB\Driver\ServerApi</a></span></td>
          <td>
           <span class="simpara">
            This option is used to declare a server API version for the manager.
            If omitted, no API version is declared.
           </span>
          </td>
         </tr>

        </tbody>
       
      </table>

     </p>
     <p class="para" id="mongodb-driver-manager.construct-autoencryption">
      Options supported by automatic encryption through the <code class="literal">autoEncryption</code> driver option:
      <table class="doctable table">
       <caption><strong>autoEncryption</strong></caption>
       
        <thead>
         <tr>
          <th>Option</th>
          <th>Type</th>
          <th>Description</th>
         </tr>

        </thead>

        <tbody class="tbody">
         
         <tr>
          <td>keyVaultClient</td>
          <td><span class="classname"><a href="class.mongodb-driver-manager.php" class="classname">MongoDB\Driver\Manager</a></span></td>
          <td>Der Manager, der verwendet wird, um Datenschlüssel-Abfragen auf einen anderen MongoDB-Cluster zu routen. Standardmäßig werden der aktuelle Manager und Cluster verwendet.</td>
         </tr>


         
         <tr>
          <td>keyVaultNamespace</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>Ein vollständig qualifizierter Namensraum (z. B. <code class="literal">&quot;databaseName.collectionName&quot;</code>), der die Kollektion bezeichnet, die alle Datenschlüssel enthält, die für Ver- und Entschlüsselung verwendet werden. Diese Option muss angegeben werden.</td>
         </tr>


         
         <tr>
          <td>kmsProviders</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <p class="para">
            Ein Dokument, das die Konfiguration für einen oder mehrere KMS-Provider enthält, die verwendet werden, um Datenschlüssel zu verschlüsseln. Zu den unterstützten Providern gehören <code class="literal">&quot;aws&quot;</code>, <code class="literal">&quot;azure&quot;</code>, <code class="literal">&quot;gcp&quot;</code>, <code class="literal">&quot;kmip&quot;</code> und <code class="literal">&quot;local&quot;</code> und wenigstens einer muss angegeben werden.
           </p>
           <p class="para">
            Wenn für <code class="literal">&quot;aws&quot;</code>, <code class="literal">&quot;azure&quot;</code> oder
            <code class="literal">&quot;gcp&quot;</code> ein leeres Dokument angegeben wird,
            versucht der Treiber, den Provider mit
            <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#automatic-credentials" class="link external">&raquo;&nbsp;Automatic Credentials</a>
            (automatische Anmeldeinformationen) zu konfigurieren.
           </p>
           <p class="para">
            Das Format für <code class="literal">&quot;aws&quot;</code> ist wie folgt:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">aws: {
    accessKeyId: &lt;string&gt;,
    secretAccessKey: &lt;string&gt;,
    sessionToken: &lt;optional string&gt;
}</pre>
</div>
           </div>

           <p class="para">
            Das Format für <code class="literal">&quot;azure&quot;</code> ist wie folgt:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">azure: {
    tenantId: &lt;string&gt;,
    clientId: &lt;string&gt;,
    clientSecret: &lt;string&gt;,
    identityPlatformEndpoint: &lt;optional string&gt; // Der Standardwert ist &quot;login.microsoftonline.com&quot;
}</pre>
</div>
           </div>

           <p class="para">
            Das Format für <code class="literal">&quot;gcp&quot;</code> ist wie folgt:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">gcp: {
    email: &lt;string&gt;,
    privateKey: &lt;base64 string&gt;|&lt;MongoDB\BSON\Binary&gt;,
    endpoint: &lt;optional string&gt; // Der Standardwert ist &quot;oauth2.googleapis.com&quot;
}</pre>
</div>
           </div>

           <p class="para">
            Das Format für <code class="literal">&quot;kmip&quot;</code> ist wie folgt:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">kmip: {
    endpoint: &lt;string&gt;
}</pre>
</div>
           </div>

           <p class="para">
          Das Format für <code class="literal">&quot;local&quot;</code> ist wie folgt:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">local: {
    // Der 96-Byte-Hauptschlüssel, der zur Ver- und Entschlüsselung von
    // Datenschlüsseln verwendet wird
    key: &lt;base64 string&gt;|&lt;MongoDB\BSON\Binary&gt;
}</pre>
</div>
           </div>

          </td>
         </tr>


         
         <tr>
          <td>tlsOptions</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <p class="para">
            Ein Dokument, das die TLS-Konfiguration für einen oder mehrere KMS-Provider enthält. Zu den unterstützten Providern gehören <code class="literal">&quot;aws&quot;</code>, <code class="literal">&quot;azure&quot;</code>, <code class="literal">&quot;gcp&quot;</code> und <code class="literal">&quot;kmip&quot;</code>. Alle Provider unterstützen die folgenden Optionen:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">&lt;provider&gt;: {
    tlsCaFile: &lt;optionale Zeichenkette&gt;,
    tlsCertificateKeyFile: &lt;optionale Zeichenkette&gt;,
    tlsCertificateKeyFilePassword: &lt;optionale Zeichenkette&gt;,
    tlsDisableOCSPEndpointCheck: &lt;optionaler Boolean&gt;
}</pre>
</div>
           </div>

          </td>
         </tr>


         <tr>
          <td>schemaMap</td>
          <td><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span></td>
          <td>
           <span class="simpara">
            Map of collection namespaces to a local JSON schema. This is
            used to configure automatic encryption. See
            <a href="https://www.mongodb.com/docs/manual/reference/security-client-side-automatic-json-schema/" class="link external">&raquo;&nbsp;Automatic Encryption Rules</a>
            in the MongoDB manual for more information. It is an error to
            specify a collection in both <code class="literal">schemaMap</code> and
            <code class="literal">encryptedFieldsMap</code>.
           </span>
           <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
            <span class="simpara">
             Supplying a <code class="literal">schemaMap</code> provides more
             security than relying on JSON schemas obtained from the
             server. It protects against a malicious server advertising a
             false JSON schema, which could trick the client into sending
             unencrypted data that should be encrypted.
            </span>
           </p></blockquote>
           <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
            <span class="simpara">
             Schemas supplied in the <code class="literal">schemaMap</code> only
             apply to configuring automatic encryption for client side
             encryption. Other validation rules in the JSON schema will
             not be enforced by the driver and will result in an error.
            </span>
           </p></blockquote>
          </td>
         </tr>

         <tr>
          <td>bypassAutoEncryption</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, <code class="literal">mongocryptd</code> will not be spawned
           automatically. This is used to disable automatic encryption.
           Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
          </td>
         </tr>

         <tr>
          <td>bypassQueryAnalysis</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           <span class="simpara">
            If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, automatic analysis of outgoing commands will be
            disabled and <code class="literal">mongocryptd</code> will not be
            spawned automatically. This enables the use case of explicit
            encryption for querying indexed fields without requiring the
            enterprise licensed <code class="literal">crypt_shared</code> library or
            <code class="literal">mongocryptd</code> process. Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
           </span>
          </td>
         </tr>

         <tr>
          <td>encryptedFieldsMap</td>
          <td><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span></td>
          <td>
           <span class="simpara">
            Map of collection namespaces to an
            <code class="literal">encryptedFields</code> document. This is used to
            configure queryable encryption. See
            <a href="https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/encrypt-and-query/" class="link external">&raquo;&nbsp;Field Encryption and Queryability</a>
            in the MongoDB manual for more information. It is an error to
            specify a collection in both
            <code class="literal">encryptedFieldsMap</code> and
            <code class="literal">schemaMap</code>.
           </span>
           <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
            <span class="simpara">
             Supplying an <code class="literal">encryptedFieldsMap</code> provides
             more security than relying on an
             <code class="literal">encryptedFields</code> obtained from the server.
             It protects against a malicious server advertising a false
             <code class="literal">encryptedFields</code>.
            </span>
           </p></blockquote>
          </td>
         </tr>

         <tr>
          <td>extraOptions</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <span class="simpara">
            The <code class="literal">extraOptions</code> relate to the
            <code class="literal">mongocryptd</code> process. The following options
            are supported:
           </span>
           <ul class="simplelist">
            <li><code class="literal">mongocryptdURI</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>): URI to connect to an existing <code class="literal">mongocryptd</code> process. Defaults to <code class="literal">&quot;mongodb://localhost:27020&quot;</code>.</li>
            <li><code class="literal">mongocryptdBypassSpawn</code> (<span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>): If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, prevent the driver from spawning <code class="literal">mongocryptd</code>. Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.</li>
            <li><code class="literal">mongocryptdSpawnPath</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>): Absolute path to search for <code class="literal">mongocryptd</code> binary. Defaults to empty string and consults system paths.</li>
            <li><code class="literal">mongocryptdSpawnArgs</code> (<span class="type"><a href="language.types.array.php" class="type array">array</a></span>): Array of string arguments to pass to <code class="literal">mongocryptd</code> when spawning. Defaults to <code class="literal">[&quot;--idleShutdownTimeoutSecs=60&quot;]</code>.</li>
            <li><code class="literal">cryptSharedLibPath</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>): Absolute path to <code class="literal">crypt_shared</code> shared library. Defaults to empty string and consults system paths.</li>
            <li><code class="literal">cryptSharedLibRequired</code> (<span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>): If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, require the driver to load <code class="literal">crypt_shared</code>. Defaults to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.</li>
           </ul>
           <span class="simpara">
            See the <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#extraoptions" class="link external">&raquo;&nbsp;Client-Side Encryption Specification</a> for more information.
           </span>
          </td>
         </tr>

        </tbody>
       
      </table>

      <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
       <span class="simpara">
        Automatic encryption is an enterprise only feature that only
        applies to operations on a collection. Automatic encryption is not
        supported for operations on a database or view, and operations that
        are not bypassed will result in error. To bypass automatic
        encryption for all operations, set <code class="literal">bypassAutoEncryption=true</code>
        in <code class="literal">autoEncryption</code>. For more information on
        allowed operations, see the
        <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#libmongocrypt-auto-encryption-whitelist" class="link external">&raquo;&nbsp;Client-Side Encryption Specification</a>.
       </span>
      </p></blockquote>
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-manager.construct-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <ul class="simplelist">
   <li>Wirft eine <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span>, wenn beim Analysieren von Argumenten ein Fehler auftritt.</li>
   <li>Throws <span class="classname"><a href="class.mongodb-driver-exception-runtimeexception.php" class="classname">MongoDB\Driver\Exception\RuntimeException</a></span> if the <code class="parameter">uri</code> format is invalid</li>
  </ul>
 </div>


 <div class="refsect1 changelog" id="refsect1-mongodb-driver-manager.construct-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>PECL mongodb 2.0.0</td>
      <td>
       <span class="simpara">
        The <code class="literal">&quot;canonicalizeHostname&quot;</code> URI option was removed.
        Use the <code class="literal">&quot;CANONICALIZE_HOST_NAME&quot;</code> property of the
        <code class="literal">&quot;authMechanismProperties&quot;</code> URI option instead.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;gssapiServiceName&quot;</code> URI option was removed.
        Use the <code class="literal">&quot;SERVICE_NAME&quot;</code> property of the
        <code class="literal">&quot;authMechanismProperties&quot;</code> URI option instead.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;safe&quot;</code> URI option was removed. Use the
        <code class="literal">&quot;w&quot;</code> and <code class="literal">&quot;wTimeoutMS&quot;</code> URI options
        instead.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;ssl&quot;</code> URI option was removed. Use the
        <code class="literal">&quot;tls&quot;</code> URI option instead.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;allow_invalid_hostname&quot;</code> driver option was
        removed. Use the <code class="literal">&quot;tlsAllowInvalidHostnames&quot;</code> URI
        option instead.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;ca_file&quot;</code> driver option was removed. Use the
        <code class="literal">&quot;tlsCAFile&quot;</code> URI option instead.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;context&quot;</code> driver option was removed. All context
        options were deprecated in favor of the various URI options related to
        TLS.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;pem_file&quot;</code> driver option was removed. Use the
        <code class="literal">&quot;tlsCertificateKeyFile&quot;</code> URI option instead.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;pem_pwd&quot;</code> driver option was removed. Use the
        <code class="literal">&quot;tlsCertificateKeyFilePassword&quot;</code> URI option instead.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;weak_cert_validation&quot;</code> driver option was removed.
        Use the <code class="literal">&quot;tlsAllowInvalidCertificates&quot;</code> URI option
        instead.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.16.0</td>
      <td>
       <span class="simpara">
        The AWS KMS provider for client-side encryption now accepts a
        <code class="literal">&quot;sessionToken&quot;</code> option, which can be used to
        authenticate with temporary AWS credentials.
       </span>
       <span class="simpara">
        Added <code class="literal">&quot;tlsDisableOCSPEndpointCheck&quot;</code> to the
        <code class="literal">&quot;tlsOptions&quot;</code> field of the
        <code class="literal">&quot;autoEncryption&quot;</code> driver option.
       </span>
       <span class="simpara">
        If an empty document is specified for the <code class="literal">&quot;azure&quot;</code> or
        <code class="literal">&quot;gcp&quot;</code> KMS provider, the driver will attempt to
        configure the provider using
        <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#automatic-credentials" class="link external">&raquo;&nbsp;Automatic Credentials</a>.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.15.0</td>
      <td>
       <span class="simpara">
        If an empty document is specified for the <code class="literal">&quot;aws&quot;</code> KMS
        provider, the driver will attempt to configure the provider using
        <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#automatic-credentials" class="link external">&raquo;&nbsp;Automatic Credentials</a>.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.14.0</td>
      <td>
       <span class="simpara">
        Added the <code class="literal">&quot;bypassQueryAnalysis&quot;</code> and
        <code class="literal">&quot;encryptedFieldsMap&quot;</code> auto encryption options.
        Additional options pertaining to <code class="literal">crypt_shared</code> are
        now supported in the <code class="literal">&quot;extraOptions&quot;</code> auto encryption
        option.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.13.0</td>
      <td>
       <span class="simpara">
        Added the <code class="literal">&quot;srvMaxHosts&quot;</code> and
        <code class="literal">&quot;srvServiceName&quot;</code> URI options.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.12.0</td>
      <td>
       <span class="simpara">
        KMIP is now supported as a KMS provider for client-side encryption and
        may be configured in the <code class="literal">&quot;kmsProviders&quot;</code> field of the
        <code class="literal">&quot;autoEncryption&quot;</code> driver option. Additionally, TLS
        options for KMS providers may now be configured in the
        <code class="literal">&quot;tlsOptions&quot;</code> field of the
        <code class="literal">&quot;autoEncryption&quot;</code> driver option.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.11.0</td>
      <td>
       <span class="simpara">
        Added the <code class="literal">&quot;loadBalanced&quot;</code> URI option.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.10.0</td>
      <td>
       <span class="simpara">
        Added the <code class="literal">&quot;disableClientPersistence&quot;</code> driver option.
       </span>
       <span class="simpara">
        Azure and GCP are now supported as KMS providers for client-side
        encryption and may be configured in the
        <code class="literal">&quot;kmsProviders&quot;</code> field of the
        <code class="literal">&quot;autoEncryption&quot;</code> driver option. Base64-encoded
        strings are now accepted as an alternative to
        <span class="classname"><a href="class.mongodb-bson-binary.php" class="classname">MongoDB\BSON\Binary</a></span> for options within
        <code class="literal">&quot;kmsProviders&quot;</code>.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.8.0</td>
      <td>
       <span class="simpara">
        Added the <code class="literal">&quot;directConnection&quot;</code>,
        <code class="literal">&quot;tlsDisableCertificateRevocationCheck&quot;</code>, and
        <code class="literal">&quot;tlsDisableOCSPEndpointCheck&quot;</code> URI options.
       </span>
       <span class="simpara">
        Added the <code class="literal">&quot;driver&quot;</code> driver option.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.7.0</td>
      <td>
       <span class="simpara">
        Added the <code class="literal">&quot;autoEncryption&quot;</code> driver option.
       </span>
       <span class="simpara">
        Specifying any SSL or TLS option via the <code class="parameter">driverOptions</code>
        parameter will now implicitly enable TLS, as is done for the
        corresponding URI options.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.6.0</td>
      <td>
       <span class="simpara">
        Added the <code class="literal">&quot;retryReads&quot;</code>, <code class="literal">&quot;tls&quot;</code>,
        <code class="literal">&quot;tlsAllowInvalidCertificates&quot;</code>,
        <code class="literal">&quot;tlsAllowInvalidHostnames&quot;</code>,
        <code class="literal">&quot;tlsCAFile&quot;</code>,
        <code class="literal">&quot;tlsCertificateKeyFile&quot;</code>,
        <code class="literal">&quot;tlsCertificateKeyFilePassword&quot;</code>, and
        <code class="literal">&quot;tlsInsecure&quot;</code> URI options.
       </span>
       <span class="simpara">
        The <code class="literal">&quot;retryWrites&quot;</code> URI option defaults to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
       </span>
       <span class="simpara">
        Specifying any SSL or TLS URI option via the connection string or
        <code class="parameter">uriOptions</code> parameter will now implicitly enable
        TLS unless <code class="literal">ssl</code> or <code class="literal">tls</code> is <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
        TLS is <em>not</em> implicitly enabled for any options in
        the <code class="parameter">driverOptions</code> parameter, which is unchanged
        from previous versions.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.5.0</td>
      <td>
       <span class="simpara">
        <code class="literal">&quot;wtimeoutMS&quot;</code> is now always validated and applied to
        the write concern. Previously, the option was ignored if
        <code class="literal">&quot;w&quot;</code> was &lt;= 1, since the timeout only applies to
        replication.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.4.0</td>
      <td>
       <span class="simpara">
        Added the <code class="literal">&quot;compressors&quot;</code>,
        <code class="literal">&quot;retryWrites&quot;</code>, and
        <code class="literal">&quot;zlibCompressionLevel&quot;</code> URI options.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.3.0</td>
      <td>
       <span class="simpara">
        The <code class="parameter">uriOptions</code> argument now accepts
        <code class="literal">&quot;authMechanism&quot;</code> and
        <code class="literal">&quot;authMechanismProperties&quot;</code> options. Previously, these
        options were only supported in the <code class="parameter">uri</code> argument.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.2.0</td>
      <td>
       <span class="simpara">
        The <code class="parameter">uri</code> argument defaults to
        <code class="literal">&quot;mongodb://127.0.0.1/&quot;</code>. The default port remains
        <code class="literal">27017</code>.
       </span>
       <span class="simpara">
        Added the <code class="literal">&quot;appname&quot;</code> URI option.
       </span>
       <span class="simpara">
        Added the <code class="literal">&quot;allow_invalid_hostname&quot;</code>,
        <code class="literal">&quot;ca_file&quot;</code>, <code class="literal">&quot;ca_dir&quot;</code>,
        <code class="literal">&quot;clr_file&quot;</code>, <code class="literal">&quot;pem_file&quot;</code>,
        <code class="literal">&quot;pem_pwd&quot;</code>, and
        <code class="literal">&quot;weak_cert_validation&quot;</code> driver options.
       </span>
       <span class="simpara">
        The PHP Streams API is no longer used for socket communication. The
        <code class="literal">&quot;connectTimeoutMS&quot;</code> URI option now defaults to 10
        seconds instead of
        <a href="filesystem.configuration.php#ini.default-socket-timeout" class="link">default_socket_timeout</a>
        in previous versions. Additionally, the extension no longer supports
        all <a href="context.ssl.php" class="link">SSL context options</a> via the
        <code class="literal">&quot;context&quot;</code> driver option.
       </span>
      </td>
     </tr>

     <tr>
      <td>PECL mongodb 1.1.0</td>
      <td>
       <span class="simpara">
        The <code class="parameter">uri</code> argument is optional and defaults to
        <code class="literal">&quot;mongodb://localhost:27017/&quot;</code>.
       </span>
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-mongodb-driver-manager.construct-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 <span class="function"><strong>MongoDB\Driver\Manager::__construct()</strong></span> basic examples</strong></p>
   <div class="example-contents"><p>Connecting to standalone MongoDB node:</p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$manager </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Manager</span><span style="color: #007700">(</span><span style="color: #DD0000">"mongodb://example.com:27017"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>
    Connecting to standalone MongoDB node via a Unix domain socket. The socket
    path may include special characters such as slashes and should be encoded
    with <span class="function"><a href="function.rawurlencode.php" class="function">rawurlencode()</a></span>.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$manager </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Manager</span><span style="color: #007700">(</span><span style="color: #DD0000">"mongodb://" </span><span style="color: #007700">. </span><span style="color: #0000BB">rawurlencode</span><span style="color: #007700">(</span><span style="color: #DD0000">"/tmp/mongodb-27017.sock"</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Connecting to a replica set:</p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$manager </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Manager</span><span style="color: #007700">(</span><span style="color: #DD0000">"mongodb://rs1.example.com,rs2.example.com/?replicaSet=myReplicaSet"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Connecting to a sharded cluster (i.e. one or more mongos instances):</p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$manager </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Manager</span><span style="color: #007700">(</span><span style="color: #DD0000">"mongodb://mongos1.example.com,mongos2.example.com/"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Connecting to MongoDB with authentication credentials for a particular user and database:</p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$manager </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Manager</span><span style="color: #007700">(</span><span style="color: #DD0000">"mongodb://myusername:mypassword@example.com/?authSource=databaseName"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>


   <div class="example-contents"><p>
    Connecting to MongoDB with authentication credentials for a particular
    user and database, where the username or password includes special
    characters (e.g. <code class="literal">@</code>, <code class="literal">:</code>,
    <code class="literal">%</code>). In the following example, the password string
    <code class="literal">myp@ss:w%rd</code> has been manually escaped; however,
    <span class="function"><a href="function.rawurlencode.php" class="function">rawurlencode()</a></span> may also be used to escape URI components
    that may contain special characters.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$manager </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Manager</span><span style="color: #007700">(</span><span style="color: #DD0000">"mongodb://myusername:myp%40ss%3Aw%25rd@example.com/?authSource=databaseName"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>


   <div class="example-contents"><p>Connecting to MongoDB with X509 authentication:</p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$manager </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Manager</span><span style="color: #007700">(<br />    </span><span style="color: #DD0000">"mongodb://example.com/?ssl=true&amp;authMechanism=MONGODB-X509"</span><span style="color: #007700">,<br />    [],<br />    [<br />        </span><span style="color: #DD0000">"pem_file" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"/path/to/client.pem"</span><span style="color: #007700">,<br />    ]<br />);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongodb-driver-manager.construct-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li><a href="mongodb.connection-handling.php" class="link">Connection handling and persistence</a></li>
   <li><a href="https://www.mongodb.com/docs/manual/reference/connection-string/" class="link external">&raquo;&nbsp;MongoDB Connection String Format</a></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>