From 6472ebd9a5c221b6187b57802ad68e2d7c03ed92 Mon Sep 17 00:00:00 2001 From: Kristina Chodorow Date: Mon, 22 Feb 2010 21:21:22 +0000 Subject: [PATCH] added db auth syntax git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@295380 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mongo/mongo/construct.xml | 35 ++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/reference/mongo/mongo/construct.xml b/reference/mongo/mongo/construct.xml index 89bf25eba5..fcbf983a29 100644 --- a/reference/mongo/mongo/construct.xml +++ b/reference/mongo/mongo/construct.xml @@ -22,17 +22,32 @@ As of version 1.0.2, server can have a special form: - mongodb://[username:password@]host1[:port1][,host2[:port2:],...]. - Breaking this down, it starts with mongodb://, to indicate - it is in this form. If username and password + + + + + + It starts with mongodb://, to indicate it is a connection + string in this form. + + If username and password 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 @, 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 - MongoConnectionException. + with the database before returning. Username and password are optional + and must be followed by an @, 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 MongoConnectionException. + + + Finally, if you specified a username and password, you may specify a database + to authenticate with. If db is not specified, "admin" + will be used.