mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Document MongoClient class and write concern defaults
https://jira.mongodb.org/browse/PHP-544 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328426 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
aaed38ddf7
commit
a3fe103a4d
16 changed files with 425 additions and 330 deletions
|
@ -18,7 +18,7 @@
|
|||
<appendix xmlns="http://docbook.org/ns/docbook" xml:id="changelog.mongo">
|
||||
<title>&ChangelogListingTitle;</title>
|
||||
<para>&ChangelogListingDescription;</para>
|
||||
<?phpdoc generate-changelog-for="ref.mongo class.mongo class.mongobindata class.mongocode class.mongocollection class.mongocursor class.mongodate class.mongodb class.mongodbref class.mongogridfs class.mongogridfscursor class.mongogridfsfile class.mongoid class.mongoint32 class.mongoint64 class.mongolog class.mongopool class.mongoregex class.mongotimestamp" ?>
|
||||
<?phpdoc generate-changelog-for="ref.mongo class.mongo class.mongobindata class.mongoclient class.mongocode class.mongocollection class.mongocursor class.mongodate class.mongodb class.mongodbref class.mongogridfs class.mongogridfscursor class.mongogridfsfile class.mongoid class.mongoint32 class.mongoint64 class.mongolog class.mongopool class.mongoregex class.mongotimestamp" ?>
|
||||
</appendix>
|
||||
|
||||
</book>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
</partintro>
|
||||
|
||||
&reference.mongo.mongo;
|
||||
&reference.mongo.mongoclient;
|
||||
&reference.mongo.mongodb;
|
||||
&reference.mongo.mongocollection;
|
||||
&reference.mongo.mongocursor;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<phpdoc:classref xml:id="class.mongo" 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 Mongo class</title>
|
||||
<title>The Mongo class [deprecated]</title>
|
||||
<titleabbrev>Mongo</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
@ -14,23 +14,23 @@
|
|||
A connection between PHP and MongoDB.
|
||||
</para>
|
||||
<para>
|
||||
This class is used to create and manage connections. A typical use is:
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$m = new Mongo(); // connect
|
||||
$db = $m->foo; // get the database named "foo"
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
This class extends <classname>MongoClient</classname> and provides access to
|
||||
several deprecated methods.
|
||||
</para>
|
||||
<para>
|
||||
See <function>Mongo::__construct</function> and the section on
|
||||
<link linkend="mongo.connecting">connecting</link> for more information
|
||||
about creating connections.
|
||||
For backwards compatibility, it also defaults the <literal>"w"</literal>
|
||||
option of its constructor argument to <literal>0</literal>, which does not
|
||||
require write operations to be acknowledged by the server. See
|
||||
<function>MongoClient::__construct</function> for more information.
|
||||
</para>
|
||||
|
||||
<warning xmlns="http://docbook.org/ns/docbook">
|
||||
<simpara>
|
||||
This class has been <emphasis>DEPRECATED</emphasis> as of version
|
||||
1.3.0. Relying on this feature is highly discouraged. Please use
|
||||
<classname>MongoClient</classname> instead.
|
||||
</simpara>
|
||||
</warning>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
|
@ -46,213 +46,24 @@ $db = $m->foo; // get the database named "foo"
|
|||
<ooclass>
|
||||
<classname>Mongo</classname>
|
||||
</ooclass>
|
||||
|
||||
<ooclass>
|
||||
<modifier>extends</modifier>
|
||||
<classname>MongoClient</classname>
|
||||
</ooclass>
|
||||
</classsynopsisinfo>
|
||||
<!-- }}} -->
|
||||
|
||||
<classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="mongo.constants.version">Mongo::VERSION</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="mongo.constants.defaulthost">Mongo::DEFAULT_HOST</varname>
|
||||
<initializer>"localhost"</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongo.constants.defaultport">Mongo::DEFAULT_PORT</varname>
|
||||
<initializer>27017</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongo.constants.rpprimary">Mongo::RP_PRIMARY</varname>
|
||||
<initializer>0</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongo.constants.rpprimarypreferred">Mongo::RP_PRIMARY_PREFERRED</varname>
|
||||
<initializer>1</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongo.constants.rpsecondary">Mongo::RP_SECONDARY</varname>
|
||||
<initializer>2</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongo.constants.rpsecondary">Mongo::RP_SECONDARY_PREFERRED</varname>
|
||||
<initializer>3</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongo.constants.rpsecondary">Mongo::RP_NEAREST</varname>
|
||||
<initializer>4</initializer>
|
||||
</fieldsynopsis>
|
||||
|
||||
<classsynopsisinfo role="comment">Fields</classsynopsisinfo>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<type>boolean</type>
|
||||
<varname linkend="mongo.props.connected">connected</varname>
|
||||
<initializer>&false;</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="mongo.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.mongo')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
||||
|
||||
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
|
||||
<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>
|
||||
&reftitle.constants;
|
||||
<section xml:id="mongo.constants.types">
|
||||
<title>Mongo Constants</title>
|
||||
<variablelist>
|
||||
<varlistentry xml:id="mongo.constants.version">
|
||||
<term><constant>Mongo::VERSION</constant></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
PHP driver version. May be suffixed with "+" or "-" if it is in-between
|
||||
versions.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mongo.constants.defaulthost">
|
||||
<term><constant>Mongo::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="mongo.constants.defaultport">
|
||||
<term><constant>Mongo::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="mongo.constants.rpprimary">
|
||||
<term><constant>Mongo::RP_PRIMARY</constant></term>
|
||||
<term><constant>0</constant></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<link linkend="mongo.readpreferences">Read preference</link> for the
|
||||
primary replica set member.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mongo.constants.rpprimarypreferred">
|
||||
<term><constant>Mongo::RP_PRIMARY_PREFERRED</constant></term>
|
||||
<term><constant>1</constant></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<link linkend="mongo.readpreferences">Read preference</link> for
|
||||
preferring the primary replica set member.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mongo.constants.rpsecondary">
|
||||
<term><constant>Mongo::RP_SECONDARY</constant></term>
|
||||
<term><constant>2</constant></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<link linkend="mongo.readpreferences">Read preference</link> for a
|
||||
secondary replica set member.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mongo.constants.rpsecondarypreferred">
|
||||
<term><constant>Mongo::RP_SECONDARY_PREFERRED</constant></term>
|
||||
<term><constant>3</constant></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<link linkend="mongo.readpreferences">Read preference</link> for
|
||||
preferring a secondary replica set member.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mongo.constants.rpnearest">
|
||||
<term><constant>Mongo::RP_NEAREST</constant></term>
|
||||
<term><constant>4</constant></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<link linkend="mongo.readpreferences">Read preference</link> for the
|
||||
nearest replica set member.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Fields</title>
|
||||
<variablelist>
|
||||
<varlistentry xml:id="mongo.props.connected">
|
||||
<term><varname>status</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="mongo.props.status">
|
||||
<term><varname>status</varname></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
If this is a persistent connection, if the connection was created for
|
||||
this object or is being reused. If this is not a persistent connection,
|
||||
this field should be &null;.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
MongoDB core docs on <link xlink:href="&url.mongodb.dochub.connections;">connecting</link>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- }}} -->
|
||||
</partintro>
|
||||
|
||||
|
|
281
reference/mongo/mongoclient.xml
Normal file
281
reference/mongo/mongoclient.xml
Normal file
|
@ -0,0 +1,281 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 327993 $ -->
|
||||
|
||||
<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 between PHP and MongoDB.
|
||||
</para>
|
||||
<para>
|
||||
This class is used to create and manage connections. A typical use is:
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$m = new MongoClient(); // connect
|
||||
$db = $m->foo; // get the database named "foo"
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</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>int</type>
|
||||
<varname linkend="mongoclient.constants.rpprimary">MongoClient::RP_PRIMARY</varname>
|
||||
<initializer>0</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongoclient.constants.rpprimarypreferred">MongoClient::RP_PRIMARY_PREFERRED</varname>
|
||||
<initializer>1</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongoclient.constants.rpsecondary">MongoClient::RP_SECONDARY</varname>
|
||||
<initializer>2</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongoclient.constants.rpsecondary">MongoClient::RP_SECONDARY_PREFERRED</varname>
|
||||
<initializer>3</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>const</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mongoclient.constants.rpsecondary">MongoClient::RP_NEAREST</varname>
|
||||
<initializer>4</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:methodsynopsis[1])" />
|
||||
</classsynopsis>
|
||||
<!-- }}} -->
|
||||
|
||||
</section>
|
||||
|
||||
<!-- Mongo constants -->
|
||||
<section>
|
||||
&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 "+" 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>0</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>1</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>2</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>3</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>4</constant></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<link linkend="mongo.readpreferences">Read preference</link> for the
|
||||
nearest replica set member.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<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>
|
||||
If this is a persistent connection, if the connection was created for
|
||||
this object or is being reused. If this is not a persistent connection,
|
||||
this field should be &null;.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
MongoDB core docs on <link xlink:href="&url.mongodb.dochub.connections;">connecting</link>.
|
||||
</para>
|
||||
</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
|
||||
-->
|
|
@ -1,22 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.close" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.close" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::close</refname>
|
||||
<refname>MongoClient::close</refname>
|
||||
<refpurpose>Closes this connection</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>Mongo::close</methodname>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>MongoClient::close</methodname>
|
||||
<methodparam choice="opt"><type>boolean|string</type><parameter>connection</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The <function>Mongo::close</function> method forcefully closes a connection to the
|
||||
database, even if persistent connections are being used. You do under
|
||||
normal circumstance <emphasis>never</emphasis> have to do this.
|
||||
The <function>MongoClient::close</function> method forcefully closes a
|
||||
connection to the database, even if persistent connections are being used.
|
||||
You should <emphasis>never</emphasis> have to do this under normal
|
||||
circumstances.
|
||||
</para>
|
||||
<para>
|
||||
</para>
|
||||
|
@ -41,14 +42,14 @@
|
|||
<para>
|
||||
If connection is &true; then all connections as known by the connection
|
||||
manager will be closed. This can include connections that are not
|
||||
referenced to in the connection string used to create the object that
|
||||
referenced in the connection string used to create the object that
|
||||
you are calling close on.
|
||||
</para>
|
||||
<para>
|
||||
If connection is a string argument, then it will only close the
|
||||
connection identified by this hash. Hashes are identifiers for a
|
||||
connection and can be obtained by calling
|
||||
<function>Mongo::getConnections</function>.
|
||||
<function>MongoClient::getConnections</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -73,7 +74,7 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
// Connect to a replicaset
|
||||
$a = new Mongo("mongodb://whisky:13000/?replicaset=seta");
|
||||
$a = new MongoClient("mongodb://whisky:13000/?replicaset=seta");
|
||||
|
||||
$connections = $a->getConnections();
|
||||
|
||||
|
@ -143,7 +144,7 @@ Closing 'whisky:13001;X;4948': ok
|
|||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>Mongo::getConnections</function></member>
|
||||
<member><function>MongoClient::getConnections</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.connect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.connect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::connect</refname>
|
||||
<refname>MongoClient::connect</refname>
|
||||
<refpurpose>Connects to a database server</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>Mongo::connect</methodname>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>MongoClient::connect</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::__construct</refname>
|
||||
<refname>MongoClient::__construct</refname>
|
||||
<refpurpose>Creates a new database connection object</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <methodname>Mongo::__construct</methodname>
|
||||
<modifier>public</modifier> <methodname>MongoClient::__construct</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>server</parameter><initializer>"mongodb://localhost:27017"</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter>options</parameter><initializer>array("connect" => &true;)</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
|
@ -56,7 +56,7 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
</para>
|
||||
<para>
|
||||
One part of the options governs how the driver reads from secondary nodes
|
||||
in a replicaset environment. Extra information on how these read
|
||||
in a replica set environment. Extra information on how these read
|
||||
preferences work is available as well through the <link
|
||||
linkend="mongo.readpreferences">read preferences</link> documentation page.
|
||||
</para>
|
||||
|
@ -94,7 +94,7 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
&true;. When set to &false; the driver will
|
||||
<emphasis>automatically</emphasis> connection to the server whenever
|
||||
it is necessary to do a query. Alternatively, you can run
|
||||
<function>Mongo::connect</function> manually.
|
||||
<function>MongoClient::connect</function> manually.
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
|
@ -156,14 +156,15 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
with control from which secondaries data can be read from.
|
||||
</para>
|
||||
<para>
|
||||
Allows values are: <literal>primary</literal>,
|
||||
<literal>primaryPreferred</literal>,
|
||||
<literal>secondary</literal>, <literal>secondaryPreferred</literal>
|
||||
and <literal>nearest</literal>.
|
||||
Allowed values are: <constant>MongoClient::RP_PRIMARY</constant>,
|
||||
<constant>MongoClient::RP_PRIMARY_PREFERRED</constant>,
|
||||
<constant>MongoClient::RP_SECONDARY</constant>,
|
||||
<constant>MongoClient::RP_SECONDARY_PREFERRED</constant> and
|
||||
<constant>MongoClient::RP_NEAREST</constant>.
|
||||
</para>
|
||||
<para>
|
||||
See the documentation on <link linkend="mongo.readpreferences">read
|
||||
preferences</link> for more information.
|
||||
preferences</link> for more information.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -171,13 +172,13 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
<literal>"readPreferenceTags"</literal>
|
||||
</para>
|
||||
<para>
|
||||
Specifies the read preference tags. Tags can be used in combination
|
||||
with the <literal>readPreference</literal> option to further control
|
||||
which secondaries data might be read from.
|
||||
Specifies the read preference tags as an array of strings. Tags can be
|
||||
used in combination with the <literal>readPreference</literal> option
|
||||
to further control which secondaries data might be read from.
|
||||
</para>
|
||||
<para>
|
||||
See the documentation on <link linkend="mongo.readpreferences">read
|
||||
preferences</link> for more information.
|
||||
preferences</link> for more information.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -215,42 +216,42 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
<literal>"w"</literal>
|
||||
</para>
|
||||
<para>
|
||||
The <literal>w</literal> options controls until how long the driver
|
||||
blocks with regards to writing to replicaset members.
|
||||
The <literal>w</literal> option specifies the write concern for the
|
||||
driver, which determines how long the driver blocks when writing. The
|
||||
default value is <literal>1</literal>.
|
||||
</para>
|
||||
<para>
|
||||
A positive integer value controls how <emphasis>many</emphasis>
|
||||
nodes in the replicaset have received the write instruction before
|
||||
the driver continues. A value of <literal>3</literal> would mean
|
||||
that the write has been applied to the primary as well as two other
|
||||
replicaset members.
|
||||
This option is applicable when connecting to both single servers and
|
||||
replica sets. A positive value controls how <emphasis>many</emphasis>
|
||||
nodes must acknowledge the write instruction before the driver
|
||||
continues. A value of <literal>1</literal> would require the single
|
||||
server or primary (in a replica set) to acknowledge the write
|
||||
operation. A value of <literal>3</literal> would cause the driver to
|
||||
block until the write has been applied to the primary as well as two
|
||||
secondary servers (in a replica set).
|
||||
</para>
|
||||
<para>
|
||||
A string value is used to control which tag sets are taken into
|
||||
account for write concerns. <literal>"majority"</literal> is special
|
||||
and makes sure that the write operation has been applied to the
|
||||
majority (more than 50%) of the participating nodes.
|
||||
and ensures that the write operation has been applied to the majority
|
||||
(more than 50%) of the participating nodes.
|
||||
</para>
|
||||
<para>
|
||||
See the <link
|
||||
xlink:href="&url.mongodb.docs;applications/replication/#replica-set-write-concern">core
|
||||
documentation</link> on replica sets for more information.
|
||||
</para>
|
||||
<para>
|
||||
Please note that setting "w" implicitly sets
|
||||
<literal>fireAndForget</literal> to <literal>false</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"wTimeout"</literal>
|
||||
</para>
|
||||
<para>
|
||||
This option is used in combination with the "w" option. It controls
|
||||
how many milliseconds the server waits for the write concern to be
|
||||
satisfied. If it takes longer then the server signals to the driver
|
||||
that it took too long and the driver will throw a
|
||||
<classname>MongoCursorException</classname> exception.
|
||||
This option is used in combination with the <literal>"w"</literal>
|
||||
option. It controls how many milliseconds the server waits for the
|
||||
write concern to be satisfied. If it takes longer then the server
|
||||
signals to the driver that it took too long and the driver will throw
|
||||
a <classname>MongoCursorException</classname> exception.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
@ -293,7 +294,7 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
<tbody>
|
||||
<row>
|
||||
<entry>1.3.0</entry>
|
||||
<entry>Added the <literal>"fireAndForget"</literal>,
|
||||
<entry>Added the <!-- <literal>"fireAndForget"</literal>, -->
|
||||
<literal>"readPreference"</literal>,
|
||||
<literal>"readPreferenceTags"</literal>, <literal>"w"</literal> and
|
||||
<literal>"wTimeout"</literal> options.</entry>
|
||||
|
@ -319,7 +320,7 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
If the connection should be persistent. If set, the connection will
|
||||
be persistent. The string representation of the value is used as an
|
||||
ID for the connection, so two instances of
|
||||
<classname>Mongo</classname> that are initialized with
|
||||
<classname>MongoClient</classname> that are initialized with
|
||||
<literal>array("persist" => "foobar")</literal> will share the same
|
||||
database connection, whereas an instance initialized with
|
||||
<literal>array("persist" => "barbaz")</literal> will use a different
|
||||
|
@ -399,7 +400,7 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>Mongo::__construct</function> replica set example</title>
|
||||
<title><function>MongoClient::__construct</function> replica set example</title>
|
||||
<para>
|
||||
This example shows how to connect the driver to a replica set. It assumes
|
||||
that there is a set of three servers: sf1.example.com, sf2.example.com, and
|
||||
|
@ -410,11 +411,11 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
<?php
|
||||
|
||||
// pass a comma-separated list of server names to the constructor
|
||||
$m1 = new Mongo("mongodb://sf2.example.com,ny1.example.com", array("replicaSet" => "myReplSet"));
|
||||
$m1 = new MongoClient("mongodb://sf2.example.com,ny1.example.com", array("replicaSet" => "myReplSet"));
|
||||
|
||||
// you only need to pass a single seed, the driver will derive the full list and
|
||||
// find the master from this seed
|
||||
$m2 = new Mongo("mongodb://ny1.example.com", array("replicaSet" => "myReplSet"));
|
||||
$m2 = new MongoClient("mongodb://ny1.example.com", array("replicaSet" => "myReplSet"));
|
||||
|
||||
?>
|
||||
]]>
|
||||
|
@ -454,7 +455,7 @@ $m2 = new Mongo("mongodb://ny1.example.com", array("replicaSet" => "myReplSet"))
|
|||
<?php
|
||||
|
||||
// MongoDB server running locally on port 20000
|
||||
$m = new Mongo("mongodb:///tmp/mongodb-20000.sock");
|
||||
$m = new MongoClient("mongodb:///tmp/mongodb-20000.sock");
|
||||
|
||||
?>
|
||||
]]>
|
||||
|
@ -467,14 +468,14 @@ $m = new Mongo("mongodb:///tmp/mongodb-20000.sock");
|
|||
<?php
|
||||
|
||||
// try to connect to the domain socket, fall back to localhost connection
|
||||
$m = new MongoDB("mongodb:///tmp/mongodb-27017.sock,localhost:27017");
|
||||
$m = new MongoClient("mongodb:///tmp/mongodb-27017.sock,localhost:27017");
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title><function>Mongo::__construct</function> authentication example</title>
|
||||
<title><function>MongoClient::__construct</function> authentication example</title>
|
||||
<para>
|
||||
A user must exist in the admin database before attempting to use
|
||||
authentication. You can create one with the Mongo shell by running:
|
||||
|
@ -500,14 +501,14 @@ switched to db admin
|
|||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$m = new Mongo("mongodb://testUser:testPass@localhost");
|
||||
$m = new MongoClient("mongodb://testUser:testPass@localhost");
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title><function>Mongo::__construct</function> read preference example</title>
|
||||
<title><function>MongoClient::__construct</function> read preference example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -516,7 +517,7 @@ $m = new Mongo("mongodb://testUser:testPass@localhost");
|
|||
$uri = 'mongodb://rs1.example.com,rs2.example.com/';
|
||||
$uri .= '?readPreference=nearest';
|
||||
$uri .= '&readPreferenceTags=dc:east';
|
||||
$m = new Mongo($uri, array('replicaSet' => 'rs'));
|
||||
$m = new MongoClient($uri, array('replicaSet' => 'rs'));
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.dropdb" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.dropdb" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::dropDB</refname>
|
||||
<refname>MongoClient::dropDB</refname>
|
||||
<refpurpose>Drops a database [deprecated]</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>array</type><methodname>Mongo::dropDB</methodname>
|
||||
<modifier>public</modifier> <type>array</type><methodname>MongoClient::dropDB</methodname>
|
||||
<methodparam><type>mixed</type><parameter>db</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
|
@ -33,10 +33,10 @@
|
|||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The database to drop. Can be a MongoDB object or the name of the database.
|
||||
The database to drop. Can be a MongoDB object or the name of the database.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
|
@ -1,27 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::__get</refname>
|
||||
<refname>MongoClient::__get</refname>
|
||||
<refpurpose>Gets a database</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>MongoDB</type><methodname>Mongo::__get</methodname>
|
||||
<modifier>public</modifier> <type>MongoDB</type><methodname>MongoClient::__get</methodname>
|
||||
<methodparam><type>string</type><parameter>dbname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This is the cleanest way of getting a database. If the database name has any
|
||||
special characters, <function>Mongo::selectDB</function> will need to be
|
||||
used. However, in most cases, this should be sufficient.
|
||||
This is the cleanest way of getting a database. If the database name has any
|
||||
special characters, <function>MongoClient::selectDB</function> will need to
|
||||
be used; however, this should be sufficient for most cases.
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$mongo = new Mongo();
|
||||
$mongo = new MongoClient();
|
||||
|
||||
// the following two lines are equivalent
|
||||
$db = $mongo->selectDB("foo");
|
||||
|
@ -46,13 +46,13 @@ $db = $mongo->foo;
|
|||
The database name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a new db object.
|
||||
</para>
|
|
@ -1,21 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.gethosts" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.gethosts" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::getHosts</refname>
|
||||
<refpurpose>Updates status for all hosts associated with this</refpurpose>
|
||||
<refname>MongoClient::getHosts</refname>
|
||||
<refpurpose>Updates status for all associated hosts</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>array</type><methodname>Mongo::getHosts</methodname>
|
||||
<modifier>public</modifier> <type>array</type><methodname>MongoClient::getHosts</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This method is only useful with a connection to a replica set. It returns
|
||||
This method is only useful with a connection to a replica set. It returns
|
||||
the status of all of the hosts in the set. Without a replica set, it will
|
||||
just return an array with one element containing the host that you are
|
||||
connected to.
|
||||
|
@ -35,7 +35,7 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns an array of information about the hosts in the set. Includes each
|
||||
Returns an array of information about the hosts in the set. Includes each
|
||||
host's hostname, its health (1 is healthy), its state (1 is primary, 2 is
|
||||
secondary, 0 is anything else), the amount of time it took to ping the
|
||||
server, and when the last ping occurred. For example, on a three-member
|
||||
|
@ -43,7 +43,7 @@
|
|||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(2) {
|
||||
array(3) {
|
||||
["A:27017"]=>
|
||||
array(4) {
|
||||
["host"]=>
|
||||
|
@ -132,7 +132,7 @@ array(2) {
|
|||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>Mongo::getConnections</function></member>
|
||||
<member><function>MongoClient::getConnections</function></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="mongo.getreadpreference" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.getreadpreference" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::getReadPreference</refname>
|
||||
<refname>MongoClient::getReadPreference</refname>
|
||||
<refpurpose>Get the read preference for this connection</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>array</type><methodname>Mongo::getReadPreference</methodname>
|
||||
<modifier>public</modifier> <type>array</type><methodname>MongoClient::getReadPreference</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
|
@ -35,13 +35,13 @@
|
|||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>Mongo::getReadPreference</methodname> return value example</title>
|
||||
<title><methodname>MongoClient::getReadPreference</methodname> return value example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$m = new Mongo();
|
||||
$m->setReadPreference(Mongo::RP_SECONDARY, array(
|
||||
$m = new MongoClient();
|
||||
$m->setReadPreference(MongoClient::RP_SECONDARY, array(
|
||||
array('dc' => 'east', 'use' => 'reporting'),
|
||||
array('dc' => 'west'),
|
||||
array(),
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.listdbs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.listdbs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::listDBs</refname>
|
||||
<refname>MongoClient::listDBs</refname>
|
||||
<refpurpose>Lists all of the databases available.</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>array</type><methodname>Mongo::listDBs</methodname>
|
||||
<modifier>public</modifier> <type>array</type><methodname>MongoClient::listDBs</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
|
@ -23,19 +23,19 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns an associative array containing three fields. The first field is
|
||||
<literal>databases</literal>, which in turn contains an array. Each element
|
||||
of the array is an associative array corresponding to a database, giving the
|
||||
database's name, size, and if it's empty. The other two fields are
|
||||
Returns an associative array containing three fields. The first field is
|
||||
<literal>databases</literal>, which in turn contains an array. Each element
|
||||
of the array is an associative array corresponding to a database, giving th
|
||||
database's name, size, and if it's empty. The other two fields are
|
||||
<literal>totalSize</literal> (in bytes) and <literal>ok</literal>, which is 1
|
||||
if this method ran successfully.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>Mongo::listDBs</methodname> example</title>
|
||||
<title><methodname>MongoClient::listDBs</methodname> example</title>
|
||||
<para>
|
||||
Example demonstrating how to use listDBs and the returned data structure.
|
||||
</para>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$mongo = new Mongo();
|
||||
$mongo = new MongoClient();
|
||||
$dbs = $mongo->listDBs();
|
||||
print_r($dbs);
|
||||
|
||||
|
@ -61,7 +61,7 @@ Array
|
|||
(
|
||||
[name] => doctrine
|
||||
[sizeOnDisk] => 218103808
|
||||
[empty] =>
|
||||
[empty] =>
|
||||
)
|
||||
)
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.selectcollection" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.selectcollection" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::selectCollection</refname>
|
||||
<refname>MongoClient::selectCollection</refname>
|
||||
<refpurpose>Gets a database collection</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>MongoCollection</type><methodname>Mongo::selectCollection</methodname>
|
||||
<modifier>public</modifier> <type>MongoCollection</type><methodname>MongoClient::selectCollection</methodname>
|
||||
<methodparam><type>string</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>collection</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
@ -29,7 +29,7 @@
|
|||
The database name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<parameter>collection</parameter>
|
||||
|
@ -39,13 +39,13 @@
|
|||
The collection name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a new collection object.
|
||||
</para>
|
||||
|
@ -61,11 +61,11 @@
|
|||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>Mongo::selectCollection</function> example</title>
|
||||
<title><function>MongoClient::selectCollection</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$m = new Mongo();
|
||||
$m = new MongoClient();
|
||||
|
||||
$c1 = $m->selectCollection("foo", "bar.baz");
|
||||
// which is equivalent to
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.selectdb" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.selectdb" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::selectDB</refname>
|
||||
<refname>MongoClient::selectDB</refname>
|
||||
<refpurpose>Gets a database</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>MongoDB</type><methodname>Mongo::selectDB</methodname>
|
||||
<modifier>public</modifier> <type>MongoDB</type><methodname>MongoClient::selectDB</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
|
@ -28,13 +28,13 @@
|
|||
The database name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a new db object.
|
||||
</para>
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="mongo.setreadpreference" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.setreadpreference" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::setReadPreference</refname>
|
||||
<refname>MongoClient::setReadPreference</refname>
|
||||
<refpurpose>Set the read preference for this connection</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>Mongo::setReadPreference</methodname>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>MongoClient::setReadPreference</methodname>
|
||||
<methodparam><type>int</type><parameter>read_preference</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter>tags</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
@ -29,16 +29,16 @@
|
|||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>Mongo::setReadPreference</methodname> tag set array syntax example</title>
|
||||
<title><methodname>MongoClient::setReadPreference</methodname> tag set array syntax example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$m = new Mongo();
|
||||
$m = new MongoClient();
|
||||
|
||||
// Prefer the nearest server in the "east" data center also used for reporting,
|
||||
// but fall back to a server in the "west" data center
|
||||
$m->setReadPreference(Mongo::RP_NEAREST, array(
|
||||
$m->setReadPreference(MongoClient::RP_NEAREST, array(
|
||||
array('dc' => 'east', 'use' => 'reporting'),
|
||||
array('dc' => 'west'),
|
||||
));
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mongo.tostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refentry xml:id="mongoclient.tostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Mongo::__toString</refname>
|
||||
<refname>MongoClient::__toString</refname>
|
||||
<refpurpose>String representation of this connection</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>string</type><methodname>Mongo::__toString</methodname>
|
||||
<modifier>public</modifier> <type>string</type><methodname>MongoClient::__toString</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
Loading…
Reference in a new issue