From fce4cad98c8b1b812dacdf439b07f34f4f76764a Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Thu, 19 Jul 2012 14:45:48 +0000 Subject: [PATCH] Document MongoCursorException->getHost() & MongoCollection->distinct() git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@326701 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mongo/mongocollection/distinct.xml | 156 ++++++++++++++++++ reference/mongo/mongocursorexception.xml | 2 + .../mongo/mongocursorexception/gethost.xml | 56 +++++++ reference/mongo/versions.xml | 1 + 4 files changed, 215 insertions(+) create mode 100644 reference/mongo/mongocollection/distinct.xml create mode 100644 reference/mongo/mongocursorexception/gethost.xml diff --git a/reference/mongo/mongocollection/distinct.xml b/reference/mongo/mongocollection/distinct.xml new file mode 100644 index 0000000000..053e8c3638 --- /dev/null +++ b/reference/mongo/mongocollection/distinct.xml @@ -0,0 +1,156 @@ + + + + + + MongoCollection::distinct + Retrieve a list of distinct values for the given key across a collection. + + + + &reftitle.description; + + public arrayMongoCollection::distinct + stringkey + arrayquery + + + The distinct command returns a list of distinct values for the given key + across a collection. + + + + + &reftitle.parameters; + + + key + + + The key to use. + + + + + query + + + An optional query parameters + + + + + + + + &reftitle.returnvalues; + + Returns an array of distinct values, &return.falseforfailure; + + + + + &reftitle.examples; + + <methodname>MongoCollection::distinct</methodname> example + +selectDB("test"); +$db->dropCollection("distinct"); +$c = $db->distinct; + +$c->insert(array("stuff" => "bar", "zip-code" => 10010)); +$c->insert(array("stuff" => "foo", "zip-code" => 10010)); +$c->insert(array("stuff" => "bar", "zip-code" => 99701), array("safe" => true)); + +$retval = $c->distinct("zip-code"); +var_dump($retval); + +$retval = $c->distinct("zip-code", array("stuff" => "foo")); +var_dump($retval); + +$retval = $c->distinct("zip-code", array("stuff" => "bar")); +var_dump($retval); + +?> +]]> + + &example.outputs; + + + int(10010) + [1]=> + int(99701) +} +array(1) { + [0]=> + int(10010) +} +array(2) { + [0]=> + int(10010) + [1]=> + int(99701) +} +]]> + + + + <methodname>MongoCollection::distinct</methodname> example on a embedded document + +insert(array("user" => array("points" => 25))); +$c->insert(array("user" => array("points" => 31))); +$c->insert(array("user" => array("points" => 25)), array("safe" => true)); + +$retval = $c->distinct("user.points"); +var_dump($retval); + +$retval = $c->distinct("user.nonexisting"); +var_dump($retval); +?> +]]> + + &example.outputs; + + + int(25) + [1]=> + int(31) +} +array(0) { +} +]]> + + + + + + + diff --git a/reference/mongo/mongocursorexception.xml b/reference/mongo/mongocursorexception.xml index a32e41408b..e508c3158e 100644 --- a/reference/mongo/mongocursorexception.xml +++ b/reference/mongo/mongocursorexception.xml @@ -406,6 +406,8 @@ catch (MongoCursorException $e) { + &reference.mongo.entities.mongocursorexception; + + + + + MongoCursorException::getHost + The hostname of the server that encountered the error + + + + &reftitle.description; + + public stringMongoCursorException::getHost + + + + Returns the hostname of the server the query was sent too. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the hostname, or NULL if the hostname is unknown. + + + + + + + diff --git a/reference/mongo/versions.xml b/reference/mongo/versions.xml index 5a78e3b67a..059a32b9e3 100644 --- a/reference/mongo/versions.xml +++ b/reference/mongo/versions.xml @@ -70,6 +70,7 @@ +