Clarify delayed connections.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328269 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Derick Rethans 2012-11-07 14:56:31 +00:00
parent f187e2978d
commit 28e9d06d53
2 changed files with 14 additions and 18 deletions

View file

@ -24,13 +24,11 @@
<programlisting role="php">
<![CDATA[
<?php
// Specifying the username and password in the connection URI
// Specifying the username and password in the connection URI (preferred)
$m = new Mongo("mongodb://${username}:${password}@localhost");
// Specifying the username and password via the options array
// Specifying the username and password via the options array (alternative)
$m = new Mongo("mongodb://localhost", array("username" => $username, "password" => $password));
?>
]]>
</programlisting>
@ -43,14 +41,11 @@ $m = new Mongo("mongodb://localhost", array("username" => $username, "password"
<programlisting role="php">
<![CDATA[
<?php
// Specifying the authentication database in the connection URI
// Specifying the authentication database in the connection URI (preferred)
$m = new Mongo("mongodb://${username}:${password}@localhost/myDatabase");
// Specifying the authentication database via the options array
// Specifying the authentication database via the options array (alternative)
$m = new Mongo("mongodb://${username}:${password}@localhost", array("db" => "myDatabase"));
?>
]]>
</programlisting>
@ -70,13 +65,14 @@ $m = new Mongo("mongodb://${username}:${password}@localhost", array("db" => "myD
<programlisting role="php">
<![CDATA[
<?php
// Using multiple servers as the seed list (prefered)
$m = new Mongo("mongodb://rs1.example.com:27017,rs2.example.com:27017/?replicaSet=myReplSetName"));
// Using one server as the seed list
$m = new Mongo("mongodb://rs1.example.com:27017", array("replicaSet" => "myReplSetName"));
// Using multiple servers as the seed list
$m = new Mongo("mongodb://rs1.example.com:27017,rs2.example.com:27017", array("replicaSet" => "myReplSetName"));
?>
]]>
</programlisting>
@ -158,9 +154,7 @@ $m = new Mongo("mongodb://mongos1.example.com:27017,mongos2.example.com:27017"))
<programlisting role="php">
<![CDATA[
<?php
$m = new Mongo("mongodb:///tmp/mongo-27017.sock");
?>
]]>
</programlisting>
@ -174,9 +168,7 @@ $m = new Mongo("mongodb:///tmp/mongo-27017.sock");
<programlisting role="php">
<![CDATA[
<?php
$m = new Mongo("mongodb://username:password@/tmp/mongo-27017.sock:0/foo");
?>
]]>
</programlisting>
@ -184,7 +176,7 @@ $m = new Mongo("mongodb://username:password@/tmp/mongo-27017.sock:0/foo");
</section>
<section>
<title>Connection Pooling (version 1.2.0+)</title>
<title>Connection Pooling (version 1.2.0-1.2.12 *only*)</title>
<para>
Creating connections is one of the most heavyweight things that the driver
does. It can take hundreds of milliseconds to set up a connection correctly,
@ -292,8 +284,9 @@ $m = new Mongo("mongodb://username:password@/tmp/mongo-27017.sock:0/foo");
<note>
<para>
This section is not relevant for 1.2.0+. In 1.2.0+, connections are always
persistent and managed automatically by the driver. See
<classname>MongoPool</classname> for more information on pooling.
persistent and managed automatically by the driver. If you are using a
1.2.x release, see <classname>MongoPool</classname> for more information on
pooling.
</para>
</note>

View file

@ -91,7 +91,10 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
</para>
<para>
If the constructor should connect before returning. Default is
&true;.
&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
<methodname>Mongo::connect</methodname> manually.
</para>
<warning>
<para>