svn: /phpdoc/en/trunk/reference/mongo/ mongo/getslave.xml queries.xml

From: Date: Thu, 07 Jul 2011 14:17:31 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/ mongo/getslave.xml queries.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-8446@lists.php.net to get a copy of this message
kristina Thu, 07 Jul 2011 14:17:31 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=313052 Log: fixed description of getSlave Changed paths: U phpdoc/en/trunk/reference/mongo/mongo/getslave.xml U phpdoc/en/trunk/reference/mongo/queries.xml Modified: phpdoc/en/trunk/reference/mongo/mongo/getslave.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongo/getslave.xml 2011-07-07 12:49:39 UTC (rev 313051) +++ phpdoc/en/trunk/reference/mongo/mongo/getslave.xml 2011-07-07 14:17:31 UTC (rev 313052) @@ -21,6 +21,14 @@ </para> <para> + When you create a connection to the database, the driver will not immediately + decide on a slave to use. Thus, after you connect, this function will return + &null; even if there are slaves available. When you first do a query with + slaveOkay set, at that point the driver will choose a slave for this + connection. At that point, this function will return the chosen slave. + </para> + + <para> See <link linkend="mongo.queries">the query section</link> of this manual for information on distributing reads to slaves. </para> @@ -62,4 +70,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 ---> +--> Modified: phpdoc/en/trunk/reference/mongo/queries.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/queries.xml 2011-07-07 12:49:39 UTC (rev 313051) +++ phpdoc/en/trunk/reference/mongo/queries.xml 2011-07-07 14:17:31 UTC (rev 313052) @@ -64,10 +64,12 @@ // on the Australian client $m1 = new Mongo("mongodb://P", array("replicaSet" => true)); +$m1->foo->bar->find()->slaveOkay()->getNext(); echo "m1's slave is ".$m1->getSlave()."\n"; // on the European client $m2 = new Mongo("mongodb://P", array("replicaSet" => true)); +$m2->foo->bar->find()->slaveOkay()->getNext(); echo "m2's slave is ".$m2->getSlave()."\n"; ?> @@ -82,6 +84,12 @@ </screen> <para> + Note that we have to do a query before a slave is chosen: slaves are chosen + lazily by the driver. <function>Mongo::getSlave</function> will return + &null; until a slave is used. + </para> + + <para> You can see what the driver thinks is the current status of the set members by running <function>Mongo::getHosts</function>. </para>

« previous php.doc.cvs (#8446) next »