From afcb5ee093e6779d659d36d353f0112d15a55cb3 Mon Sep 17 00:00:00 2001 From: Kristina Chodorow Date: Thu, 7 Jan 2010 21:59:21 +0000 Subject: [PATCH] added timeout, updated constructor git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@293232 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mongo/mongo.xml | 64 +--------------- reference/mongo/mongo/construct.xml | 13 ++++ reference/mongo/mongocursor/timeout.xml | 97 +++++++++++++++++++++++++ reference/mongo/versions.xml | 2 + 4 files changed, 113 insertions(+), 63 deletions(-) create mode 100644 reference/mongo/mongocursor/timeout.xml diff --git a/reference/mongo/mongo.xml b/reference/mongo/mongo.xml index 1c6a57ed6f..6ac91bb2cc 100644 --- a/reference/mongo/mongo.xml +++ b/reference/mongo/mongo.xml @@ -21,53 +21,7 @@ selectDB("foo"); // get a database object - -?> -]]> - - - - - This class has two static fields: Mongo::$connections and - Mongo::$pconnections which track the number of open - connections and persistent connections, respectively. - Mongo::$connections is inclusive, it basically counts all - open sockets, including persistent connections. - - - An example of how different types of connections affect these variables: - - "foo")); - -/* - * Mongo::$connections is 2 - * Mongo::$pconnections is 1 - */ - -// reuse persistent connection -$m3 = new Mongo("localhost", array("persist" => "foo")); - -/* - * Mongo::$connections is 2 - * Mongo::$pconnections is 1 - */ +$db = $m->foo; // get the database named "foo" ?> ]]> @@ -114,22 +68,6 @@ $m3 = new Mongo("localhost", array("persist" => "foo")); 27017 - Static Fields - - public - static - int - connections - 0 - - - public - static - int - pconnections - 0 - - Fields public diff --git a/reference/mongo/mongo/construct.xml b/reference/mongo/mongo/construct.xml index ff51ac273b..f3c104c8d3 100644 --- a/reference/mongo/mongo/construct.xml +++ b/reference/mongo/mongo/construct.xml @@ -34,6 +34,19 @@ it could not connect to any of the hosts, it will throw a MongoConnectionException. + + + + <parameter>server</parameter> Format + + + Before version 1.0.2, server could not be prefixed + with mongodb://, contain username and password, or + contain more than two hostnames. See the changelog below for more details. + + + + If you elect not to connect immediately (you pass the option array("connect" => false)), you will need to call diff --git a/reference/mongo/mongocursor/timeout.xml b/reference/mongo/mongocursor/timeout.xml new file mode 100644 index 0000000000..a4a3c01511 --- /dev/null +++ b/reference/mongo/mongocursor/timeout.xml @@ -0,0 +1,97 @@ + + + + + + MongoCursor::timeout + Sets a client-side timeout for this query + + + + &reftitle.description; + + public MongoCursorMongoCursor::timeout + intms + + + + + &reftitle.parameters; + + + + ms + + + + The number of milliseconds for the cursor to wait for a response. By + default, the cursor will wait forever. + + + + + + + + &reftitle.returnvalues; + + This cursor. + + + + + &reftitle.examples; + + <function>MongoCursor::timeout</function> example + + A query where the cursor waits for one second for a response. + + +find()->timeout(1000); + +try { + foreach ($cursor as $value) { + print_r($value); + } +} +catch(MongoCursorTimeoutException $e) { + echo "query took too long!"; +} + +?> +]]> + + + + + + &reftitle.errors; + + Causes methods that fetch results to throw + MongoCursorTimeoutExceptions if the query takes longer + than the number of milliseconds specified. + + + + diff --git a/reference/mongo/versions.xml b/reference/mongo/versions.xml index 5402bfcae8..bbc2a9d47e 100644 --- a/reference/mongo/versions.xml +++ b/reference/mongo/versions.xml @@ -70,6 +70,7 @@ + @@ -105,6 +106,7 @@ +