mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-20 02:48:56 +00:00

Constant values are already reported in <fieldsynopsis> blocks. Furthermore, literal values should not appear within <term><constant> tags. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345085 c90b9560-bf6c-de11-be94-00142212c4b1
225 lines
7.3 KiB
XML
225 lines
7.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
<phpdoc:classref xml:id="class.mongodb" 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 MongoDB class</title>
|
|
<titleabbrev>MongoDB</titleabbrev>
|
|
|
|
<partintro>
|
|
|
|
<!-- {{{ Mongodb intro -->
|
|
<section xml:id="mongodb.intro">
|
|
&reftitle.intro;
|
|
<para>
|
|
Instances of this class are used to interact with a database. To get a
|
|
database:
|
|
<example>
|
|
<title>Selecting a database</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$m = new MongoClient(); // connect
|
|
$db = $m->selectDB("example");
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
Database names can use almost any character in the ASCII range. However,
|
|
they cannot contain " ", "." or be the empty string.
|
|
The name "system" is also reserved.
|
|
</para>
|
|
<para>
|
|
A few unusual, but valid, database names: "null", "[x,y]", "3", "\"", "/".
|
|
</para>
|
|
<para>
|
|
Unlike collection names, database names may contain "$".
|
|
</para>
|
|
</section>
|
|
<!-- }}} -->
|
|
|
|
<section xml:id="mongodb.synopsis">
|
|
&reftitle.classsynopsis;
|
|
|
|
<!-- {{{ Synopsis -->
|
|
<classsynopsis>
|
|
<ooclass><classname>MongoDB</classname></ooclass>
|
|
|
|
<!-- {{{ Class synopsis -->
|
|
<classsynopsisinfo>
|
|
<ooclass>
|
|
<classname>MongoDB</classname>
|
|
</ooclass>
|
|
</classsynopsisinfo>
|
|
<!-- }}} -->
|
|
|
|
<classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
|
|
<fieldsynopsis>
|
|
<modifier>const</modifier>
|
|
<type>int</type>
|
|
<varname linkend="mongodb.constants.profilingoff">MongoDB::PROFILING_OFF</varname>
|
|
<initializer>0</initializer>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>const</modifier>
|
|
<type>int</type>
|
|
<varname linkend="mongodb.constants.profilingslow">MongoDB::PROFILING_SLOW</varname>
|
|
<initializer>1</initializer>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>const</modifier>
|
|
<type>int</type>
|
|
<varname linkend="mongodb.constants.profilingon">MongoDB::PROFILING_ON</varname>
|
|
<initializer>2</initializer>
|
|
</fieldsynopsis>
|
|
|
|
<classsynopsisinfo role="comment">Fields</classsynopsisinfo>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<type>integer</type>
|
|
<varname linkend="mongodb.props.w">w</varname>
|
|
<initializer>1</initializer>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<type>integer</type>
|
|
<varname linkend="mongodb.props.wtimeout">wtimeout</varname>
|
|
<initializer>10000</initializer>
|
|
</fieldsynopsis>
|
|
|
|
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongodb')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
|
</classsynopsis>
|
|
<!-- }}} -->
|
|
|
|
</section>
|
|
|
|
<section>
|
|
&reftitle.constants;
|
|
<section xml:id="mongodb.constants.types">
|
|
<title>MongoDB Log Levels</title>
|
|
<variablelist>
|
|
|
|
<varlistentry xml:id="mongodb.constants.profilingoff">
|
|
<term><constant>MongoDB::PROFILING_OFF</constant></term>
|
|
<listitem>
|
|
<simpara>
|
|
Profiling is off.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="mongodb.constants.profilingslow">
|
|
<term><constant>MongoDB::PROFILING_SLOW</constant></term>
|
|
<listitem>
|
|
<simpara>
|
|
Profiling is on for slow operations (>100 ms).
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="mongodb.constants.profilingon">
|
|
<term><constant>MongoDB::PROFILING_ON</constant></term>
|
|
<listitem>
|
|
<simpara>
|
|
Profiling is on for all operations.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</section>
|
|
</section>
|
|
|
|
<section>
|
|
<title>Fields</title>
|
|
<variablelist>
|
|
<varlistentry xml:id="mongodb.props.w">
|
|
<term><varname>w</varname></term>
|
|
<term>1</term>
|
|
<listitem>
|
|
<para>
|
|
The number of servers to replicate a change to before returning success.
|
|
Inherited by instances of <classname>MongoCollection</classname> derived
|
|
from this. <literal>w</literal> functionality is only available in
|
|
version 1.5.1+ of the MongoDB server and 1.0.8+ of the driver.
|
|
</para>
|
|
<para>
|
|
<literal>w</literal> is used whenever you need to adjust the
|
|
acknowledgement level
|
|
(<function>MongoCollection::insert</function>,
|
|
<function>MongoCollection::update</function>,
|
|
<function>MongoCollection::remove</function>,
|
|
<function>MongoCollection::save</function>, and
|
|
<function>MongoCollection::ensureIndex</function> all support this
|
|
option). With the default value (1), an acknowledged operation will return once
|
|
the database server has the operation. If the server goes down before
|
|
the operation has been replicated to a secondary, it is possible to lose
|
|
the operation forever. Thus, you can specify <literal>w</literal> to be
|
|
higher than one and guarantee that at least one secondary has the
|
|
operation before it is considered successful.
|
|
</para>
|
|
<para>
|
|
For example, if <literal>w</literal> is 2, the primary and one secondary
|
|
must have a record of the operation or the driver will throw a
|
|
<classname>MongoCursorException</classname>. It is tempting to set
|
|
<literal>w</literal> to the total number of secondaries + primary, but
|
|
then if one secondary is down the operation will fail and an exception
|
|
will be thrown, so usually <literal>w=2</literal> is safest (primary and
|
|
one secondary).
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="mongodb.props.wtimeout">
|
|
<term><varname>wtimeout</varname></term>
|
|
<term>10000</term>
|
|
<listitem>
|
|
<para>
|
|
The number of milliseconds to wait for <literal>MongoDB::$w</literal>
|
|
replications to take place. Inherited by instances of
|
|
<classname>MongoCollection</classname> derived from this.
|
|
<literal>w</literal> functionality is only available in version 1.5.1+ of
|
|
the MongoDB server and 1.0.8+ of the driver.
|
|
</para>
|
|
<para>
|
|
Unless <literal>wtimeout</literal> is set, the server waits forever for
|
|
replicating to <literal>w</literal> servers to finish. The driver
|
|
defaults to waiting for 10 seconds, you can change this value to alter
|
|
its behavior.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</section>
|
|
|
|
<section>
|
|
&reftitle.seealso;
|
|
<para>
|
|
MongoDB core docs on <link xlink:href="&url.mongodb.glossary;#term-database">databases</link>.
|
|
</para>
|
|
</section>
|
|
</partintro>
|
|
|
|
&reference.mongo.entities.mongodb;
|
|
|
|
</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
|
|
-->
|