<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 331122 $ -->

<phpdoc:classref xml:id="class.mongoclient" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

 <title>The MongoClient class</title>
 <titleabbrev>MongoClient</titleabbrev>

 <partintro>
  <!-- {{{ MongoClient intro -->
  <section xml:id="mongoclient.intro">
   &reftitle.intro;
   <para>
    A connection manager for PHP and MongoDB.
   </para>
   <para>
    This class is used to create and manage connections. A typical use is:
    <example xml:id="mongoclient.intro-example">
     <title><classname>MongoClient</classname> basic usage</title>
     <programlisting role="php">
<![CDATA[
<?php

$m = new MongoClient(); // connect
$db = $m->foo; // get the database named "foo"

?>
]]>
     </programlisting>
    </example>
   </para>
   <para>
    See <function>MongoClient::__construct</function> and the section on
    <link linkend="mongo.connecting">connecting</link> for more information
    about creating connections.
   </para>
  </section>
  <!-- }}} -->

  <section xml:id="mongoclient.synopsis">
   &reftitle.classsynopsis;

   <!-- {{{ Synopsis -->
   <classsynopsis>
    <ooclass><classname>MongoClient</classname></ooclass>

    <!-- {{{ Class synopsis -->
    <classsynopsisinfo>
     <ooclass>
      <classname>MongoClient</classname>
     </ooclass>
    </classsynopsisinfo>
    <!-- }}} -->

    <classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="mongoclient.constants.version">MongoClient::VERSION</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="mongoclient.constants.defaulthost">MongoClient::DEFAULT_HOST</varname>
     <initializer>"localhost"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongoclient.constants.defaultport">MongoClient::DEFAULT_PORT</varname>
     <initializer>27017</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="mongoclient.constants.rpprimary">MongoClient::RP_PRIMARY</varname>
     <initializer>"primary"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="mongoclient.constants.rpprimarypreferred">MongoClient::RP_PRIMARY_PREFERRED</varname>
     <initializer>"primaryPreferred"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="mongoclient.constants.rpsecondary">MongoClient::RP_SECONDARY</varname>
     <initializer>"secondary"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="mongoclient.constants.rpsecondary">MongoClient::RP_SECONDARY_PREFERRED</varname>
     <initializer>"secondaryPreferred"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="mongoclient.constants.rpsecondary">MongoClient::RP_NEAREST</varname>
     <initializer>"nearest"</initializer>
    </fieldsynopsis>

    <classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>public</modifier>
     <type>boolean</type>
     <varname linkend="mongoclient.props.connected">connected</varname>
     <initializer>&false;</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <type>string</type>
     <varname linkend="mongoclient.props.status">status</varname>
     <initializer>&null;</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>protected</modifier>
     <type>string</type>
     <varname>server</varname>
     <initializer>&null;</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>protected</modifier>
     <type>boolean</type>
     <varname>persistent</varname>
     <initializer>&null;</initializer>
    </fieldsynopsis>

    <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
    <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongoclient')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])" />
    <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongoclient')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
   </classsynopsis>
   <!-- }}} -->

  </section>

<!-- Mongo constants -->
  <section xml:id="mongoclient.constants">
   &reftitle.constants;
   <section xml:id="mongoclient.constants.types">
    <title>MongoClient Constants</title>
    <variablelist>
     <varlistentry xml:id="mongoclient.constants.version">
      <term><constant>MongoClient::VERSION</constant></term>
      <listitem>
       <simpara>
        PHP driver version. May be suffixed with "dev", "+" or "-" if it is
        in-between versions.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongoclient.constants.defaulthost">
      <term><constant>MongoClient::DEFAULT_HOST</constant></term>
      <term><constant>"localhost"</constant></term>
      <listitem>
       <simpara>
        Host to connect to if no host is given.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongoclient.constants.defaultport">
      <term><constant>MongoClient::DEFAULT_PORT</constant></term>
      <term><constant>27017</constant></term>
      <listitem>
       <simpara>
        Port to connect to if no port is given.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongoclient.constants.rpprimary">
      <term><constant>MongoClient::RP_PRIMARY</constant></term>
      <term><constant>"primary"</constant></term>
      <listitem>
       <simpara>
        <link linkend="mongo.readpreferences">Read preference</link> for the
        primary replica set member.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongoclient.constants.rpprimarypreferred">
      <term><constant>MongoClient::RP_PRIMARY_PREFERRED</constant></term>
      <term><constant>"primaryPreferred"</constant></term>
      <listitem>
       <simpara>
        <link linkend="mongo.readpreferences">Read preference</link> for
        preferring the primary replica set member.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongoclient.constants.rpsecondary">
      <term><constant>MongoClient::RP_SECONDARY</constant></term>
      <term><constant>"secondary"</constant></term>
      <listitem>
       <simpara>
        <link linkend="mongo.readpreferences">Read preference</link> for a
        secondary replica set member.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongoclient.constants.rpsecondarypreferred">
      <term><constant>MongoClient::RP_SECONDARY_PREFERRED</constant></term>
      <term><constant>"secondaryPreferred"</constant></term>
      <listitem>
       <simpara>
        <link linkend="mongo.readpreferences">Read preference</link> for
        preferring a secondary replica set member.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongoclient.constants.rpnearest">
      <term><constant>MongoClient::RP_NEAREST</constant></term>
      <term><constant>"nearest"</constant></term>
      <listitem>
       <simpara>
        <link linkend="mongo.readpreferences">Read preference</link> for the
        nearest replica set member.
       </simpara>
      </listitem>
     </varlistentry>
    </variablelist>
   </section>
  </section>

  <section xml:id="mongoclient.fields">
   <title>Fields</title>
   <variablelist>
    <varlistentry xml:id="mongoclient.props.connected">
     <term><varname>connected</varname></term>
     <listitem>
      <simpara>
       This property will be set to &true; if we have a open connection
       the database based on the ReadPreference and tagsets (for ReplicaSet
       connections), &false; otherwise. This property does not take
       authentication into account.
      </simpara>
     </listitem>
    </varlistentry>
    <varlistentry xml:id="mongoclient.props.status">
     <term><varname>status</varname></term>
     <listitem>
      <simpara>
       This property is no longer used and will be set to &null; In driver
       versions 1.1.x and earlier, this may be set to a string value (e.g.
       <literal>"recycled"</literal>, <literal>"new"</literal>) when persistent
       connections are used.
      </simpara>
     </listitem>
    </varlistentry>
   </variablelist>
  </section>

  <section role="seealso" xml:id="mongoclient.seealso">
   &reftitle.seealso;
   <simplelist>
    <member><xref linkend="mongo.readpreferences" /></member>
    <member><xref linkend="mongo.writeconcerns" /></member>
    <member><xref linkend="mongo.connecting" /></member>
    <member>MongoDB core docs on <link xlink:href="&url.mongodb.dochub.connections;">connecting</link></member>
   </simplelist>
  </section>

<!-- }}} -->
 </partintro>

 &reference.mongo.entities.mongoclient;

</phpdoc:classref>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
