mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
Added documentation for connection string options.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328214 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
206dda18e9
commit
d18529e7bd
1 changed files with 140 additions and 24 deletions
|
@ -50,9 +50,15 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
be used.
|
||||
</para>
|
||||
<para>
|
||||
An optional query string may be used to specify
|
||||
<link linkend="mongo.readpreferences">read preferences</link> for the
|
||||
connection.
|
||||
An optional query string may be used to specify extra options. The same
|
||||
options are supported through the <parameter>options</parameter> array as
|
||||
well, and are therefore redescribed there.
|
||||
</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
|
||||
preferences work is available as well through the <link
|
||||
linkend="mongo.readpreferences">read preferences</link> documentation page.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@ -87,36 +93,43 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
If the constructor should connect before returning. Default is
|
||||
&true;.
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
This option is not supported through the connection string.
|
||||
</para>
|
||||
</warning>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"timeout"</literal>
|
||||
<literal>"db"</literal>
|
||||
</para>
|
||||
<para>
|
||||
For how long the driver should try to connect to the database (in
|
||||
milliseconds).
|
||||
The database to authenticate against can be specified here, instead of
|
||||
including it in the host list. This overrides a database given in the
|
||||
host list.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"replicaSet"</literal>
|
||||
<literal>"fireAndForget"</literal>
|
||||
</para>
|
||||
<para>
|
||||
The name of the replica set to connect to. If this is given, the
|
||||
master will be determined by using the <literal>ismaster</literal>
|
||||
database command on the seeds, so the driver may end up connecting to
|
||||
a server that was not even listed. See the replica set example below
|
||||
for details.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"username"</literal>
|
||||
This option influence how the drivers deals with potential errors
|
||||
from write operations (<function>MongoCollection::insert</function>,
|
||||
<function>MongoCollection::update</function> and
|
||||
<function>MongoCollection::delete</function>).
|
||||
</para>
|
||||
<para>
|
||||
The username can be specified here, instead of including it in the
|
||||
host list. This is especially useful if a username has a ":" in it.
|
||||
This overrides a username set in the host list.
|
||||
When set to <literal>true</literal> (the default) the driver does
|
||||
<emphasis>not</emphasis> wait until the server has acknowledged the
|
||||
write. When set to <literal>false</literal> (the
|
||||
<emphasis>recommended</emphasis> setting), the driver will wait
|
||||
until the database has acknowledged the write.
|
||||
</para>
|
||||
<para>
|
||||
If an error occurs, and <literal>fireAndForget</literal> is set to
|
||||
<literal>false</literal>, then a
|
||||
<classname>MongoCursorException</classname> is thrown.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -131,12 +144,108 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"db"</literal>
|
||||
<literal>"readPreference"</literal>
|
||||
</para>
|
||||
<para>
|
||||
The database to authenticate against can be specified here, instead of
|
||||
including it in the host list. This overrides a database given in the
|
||||
host list.
|
||||
Specifies the read preference type. Read preferences provide you
|
||||
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>.
|
||||
</para>
|
||||
<para>
|
||||
See the documentation on <link linkend="mongo.readpreferences">read
|
||||
preferences</link> for more information.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<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.
|
||||
</para>
|
||||
<para>
|
||||
See the documentation on <link linkend="mongo.readpreferences">read
|
||||
preferences</link> for more information.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"replicaSet"</literal>
|
||||
</para>
|
||||
<para>
|
||||
The name of the replica set to connect to. If this is given, the
|
||||
master will be automatically be determined. This means that the
|
||||
driver may end up connecting to a server that was not even listed.
|
||||
See the replica set example below for details.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"timeout"</literal>
|
||||
</para>
|
||||
<para>
|
||||
For how long the driver should try to connect to the database (in
|
||||
milliseconds).
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"username"</literal>
|
||||
</para>
|
||||
<para>
|
||||
The username can be specified here, instead of including it in the
|
||||
host list. This is especially useful if a username has a ":" in it.
|
||||
This overrides a username set in the host list.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>"w"</literal>
|
||||
</para>
|
||||
<para>
|
||||
The <literal>w</literal> options controls until how long the driver
|
||||
blocks with regards to writing to replicaset members.
|
||||
</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.
|
||||
</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.
|
||||
</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.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
@ -177,6 +286,13 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
|||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1.3.0</entry>
|
||||
<entry>Added the <literal>"fireAndForget"</literal>,
|
||||
<literal>"readPreference"</literal>,
|
||||
<literal>"readPreferenceTags"</literal>, <literal>"w"</literal> and
|
||||
<literal>"wTimeout"</literal> options.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>1.2.0</entry>
|
||||
<entry>
|
||||
|
|
Loading…
Reference in a new issue