svn: /phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/ construct.xml
| From: | Jeremy Mikola | Date: | Sat, 09 Jul 2016 17:37:51 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/ construct.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-14296@lists.php.net to get a copy of this message | ||
jmikola Sat, 09 Jul 2016 17:37:51 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=339597
Log:
PHPC-637: Revise notes on encoding MongoDB URI components
Changed paths:
U phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/construct.xml
Modified: phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/construct.xml
===================================================================
--- phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/construct.xml 2016-07-09 16:02:01 UTC
(rev 339596)
+++ phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/construct.xml 2016-07-09 17:37:51 UTC
(rev 339597)
@@ -36,10 +36,13 @@
</programlisting>
</para>
<para>
- The <parameter>uri</parameter> is a URL, and hence, anything that is a
- special URL character needs to be URL encoded. This is particularly
- something to take into account for the password, as that is likely to
- have characters such as <literal>%</literal> in it.
+ The <parameter>uri</parameter> is a URL, hence any special characters in
+ its components need to be URL encoded according to
+ <link xlink:href="&url.rfc;3986">RFC 3986</link>. This is
particularly
+ relevant to the username and password, which can often include special
+ characters such as <literal>@</literal>, <literal>:</literal>, or
+ <literal>%</literal>. The <function>rawurlencode</function> function
may
+ be used to encode constituent parts of the URI.
</para>
</listitem>
</varlistentry>
@@ -125,15 +128,16 @@
<para>
Connecting to MongoDB with authentication credentials for a particular
- user and database, with the special characters <literal>@</literal> and
- <literal>%</literal> in the password. The password being used is
- <literal>Hell@Peop%e</literal>.
+ user and database, where the username or password includes special
+ characters (e.g. <literal>@</literal>, <literal>:</literal>,
+ <literal>%</literal>). In the following example,
+ <literal>myp@ss:w%rd</literal> is being used as the password:
</para>
<programlisting role="php">
<![CDATA[
<?php
-$manager = new
MongoDB\Driver\Manager("mongodb://giant:Hell%40Peop%25e@localhost:27017/mydatabase");
+$manager = new
MongoDB\Driver\Manager("mongodb://myusername:myp%40ss%3Aw%25rd@localhost:27017/mydatabase");
?>
]]>