mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
Don't mention deprecated MongoDB::authenticate() method in connection docs
https://jira.mongodb.org/browse/PHP-520 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@327895 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
6a18181c79
commit
d4bd7ce34c
1 changed files with 0 additions and 35 deletions
|
@ -58,41 +58,6 @@ $m = new Mongo("mongodb://${username}:${password}@localhost", array("db" => "myD
|
|||
If your connection is dropped, the driver will automatically attempt to
|
||||
reconnect and reauthenticate you.
|
||||
</para>
|
||||
<para>
|
||||
You can also authenticate on a per-database level with
|
||||
<function>MongoDB::authenticate</function>:
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$m = new Mongo();
|
||||
$db = $m->admin;
|
||||
|
||||
$db->authenticate($username, $password);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
There is a major disadvantage to this method: if the connection is dropped
|
||||
and then reconnects, the new connection will not be authenticated. If you use
|
||||
the URI format, the PHP driver will automatically authenticate the user
|
||||
whenever a new connection is made.
|
||||
</para>
|
||||
<para>
|
||||
To authenticate with a different database, specify the database name after
|
||||
the hosts. This example will log the user into the "blog" database:
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$m = new Mongo("mongodb://${username}:${password}@localhost/blog");
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
|
Loading…
Reference in a new issue