added db auth syntax

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@295380 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kristina Chodorow 2010-02-22 21:21:22 +00:00
parent cb75568010
commit 6472ebd9a5

View file

@ -22,17 +22,32 @@
</para>
<para>
As of version 1.0.2, <parameter>server</parameter> can have a special form:
<literal>mongodb://[username:password@]host1[:port1][,host2[:port2:],...]</literal>.
Breaking this down, it starts with <literal>mongodb://</literal>, to indicate
it is in this form. If <literal>username</literal> and <literal>password</literal>
<programlisting>
<![CDATA[
mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
]]>
</programlisting>
</para>
<para>
It starts with <literal>mongodb://</literal>, to indicate it is a connection
string in this form.
</para>
<para>If <literal>username</literal> and <literal>password</literal>
are specified, the constructor will attempt to authenticate the connection
with the admin database before returning. Username and password are optional
and must be followed by an <literal>@</literal>, if specified. At least one
host must be given (port optional, always defaulting to 27017) and as many
hosts as desired may be connected to. Host names are comma-separated and the
constructor will return successfully if it connected to at least one host. If
it could not connect to any of the hosts, it will throw a
<classname>MongoConnectionException</classname>.
with the database before returning. Username and password are optional
and must be followed by an <literal>@</literal>, if specified.
</para>
<para>
At least one host must be given (port optional, always defaulting to 27017)
and as many hosts as desired may be connected to. Host names are
comma-separated and the constructor will return successfully if it connected
to at least one host. If it could not connect to any of the hosts, it will
throw a <classname>MongoConnectionException</classname>.
</para>
<para>
Finally, if you specified a username and password, you may specify a database
to authenticate with. If <literal>db</literal> is not specified, "admin"
will be used.
</para>
<warning>