<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Returns the address being used by this for slaveOkay reads</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongo.getpoolsize.html">Mongo::getPoolSize</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongo.getslaveokay.html">Mongo::getSlaveOkay</a></div> <div class="up"><a href="class.mongo.html">Mongo</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mongo.getslave" class="refentry"> <div class="refnamediv"> <h1 class="refname">Mongo::getSlave</h1> <p class="verinfo">(PECL mongo >=1.1.0)</p><p class="refpurpose"><span class="refname">Mongo::getSlave</span> — <span class="dc-title">Returns the address being used by this for slaveOkay reads</span></p> </div> <div class="refsect1 description" id="refsect1-mongo.getslave-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>Mongo::getSlave</strong></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment"> This finds the address of the secondary currently being used for reads. It is a read-only method: it does not change anything about the internal state of the object. </p> <p class="para"> When you create a connection to the database, the driver will not immediately decide on a secondary to use. Thus, after you connect, this function will return <strong><code>NULL</code></strong> even if there are secondaries available. When you first do a query with slaveOkay set, at that point the driver will choose a secondary for this connection. At that point, this function will return the chosen secondary. </p> <p class="para"> See <a href="mongo.queries.html" class="link">the query section</a> of this manual for information on distributing reads to secondaries. </p> </div> <div class="refsect1 parameters" id="refsect1-mongo.getslave-parameters"> <h3 class="title">Parameters</h3> <p class="para">This function has no parameters.</p> </div> <div class="refsect1 returnvalues" id="refsect1-mongo.getslave-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The address of the secondary this connection is using for reads. </p> <p class="para"> This returns <strong><code>NULL</code></strong> if this is not connected to a replica set or not yet initialized. </p> </div> <div class="refsect1 errors" id="refsect1-mongo.getslave-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para">Issues <strong><code>E_DEPRECATED</code></strong> warning</p> <p class="para"> The returned results aren't really useful as the secondary selection process is done on each query and database command execution. </p> </div> <div class="refsect1 changelog" id="refsect1-mongo.getslave-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>1.2.11</td> <td>Emits <strong><code>E_DEPRECATED</code></strong> when used.</td> </tr> </tbody> </table> </p> </div> <div class="refsect1 seealso" id="refsect1-mongo.getslave-seealso"> <h3 class="title">See Also</h3> <ul class="simplelist"> <li class="member"> <span class="function"><a href="mongocursor.info.html" class="function" rel="rdfs-seeAlso">MongoCursor::info()</a> - Gets the query, fields, limit, and skip for this cursor</span></li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongo.getpoolsize.html">Mongo::getPoolSize</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongo.getslaveokay.html">Mongo::getSlaveOkay</a></div> <div class="up"><a href="class.mongo.html">Mongo</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>