Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 9417

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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 information about indexes on this collection</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongocollection.getdbref.html">MongoCollection::getDBRef</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongocollection.getname.html">MongoCollection::getName</a></div>
 <div class="up"><a href="class.mongocollection.html">MongoCollection</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongocollection.getindexinfo" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoCollection::getIndexInfo</h1>
  <p class="verinfo">(PECL mongo &gt;=0.9.0)</p><p class="refpurpose"><span class="refname">MongoCollection::getIndexInfo</span> &mdash; <span class="dc-title">Returns information about indexes on this collection</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongocollection.getindexinfo-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>MongoCollection::getIndexInfo</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongocollection.getindexinfo-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongocollection.getindexinfo-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   This function returns an array in which each element describes an index.
   Elements will contain the values <em>name</em> for the name of
   the index, <em>ns</em> for the namespace (a combination of the
   database and collection name), and <em>key</em> for a list of all
   fields in the index and their ordering. Additional values may be present for
   special indexes, such as <em>unique</em> or
   <em>sparse</em>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mongocollection.getindexinfo-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1456">
   <p><strong>Example #1  <span class="function"><strong>MongoCollection::getIndexInfo()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">MongoClient</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">selectCollection</span><span style="color: #007700">(</span><span style="color: #DD0000">'test'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'venues'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getIndexInfo</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
array(
  0 =&gt; array(
    &quot;v&quot; =&gt; 1,
    &quot;key&quot; =&gt; array(
      &quot;_id&quot; =&gt; 1,
    ),
    &quot;ns&quot; =&gt; &quot;test.venues&quot;,
    &quot;name&quot; =&gt; &quot;_id_&quot;,
  ),
  1 =&gt; array(
    &quot;v&quot; =&gt; 1,
    &quot;key&quot; =&gt; array(
      &quot;name&quot; =&gt; 1,
    ),
    &quot;unique&quot; : true,
    &quot;ns&quot; =&gt; &quot;test.venues&quot;,
    &quot;name&quot; =&gt; &quot;name_1&quot;,
  ),
  2 =&gt; array(
    &quot;v&quot; =&gt; 1,
    &quot;key&quot; =&gt; array(
      &quot;type&quot; =&gt; 1,
      &quot;createdAt&quot; =&gt; -1,
    ),
    &quot;ns&quot; =&gt; &quot;test.venues&quot;,
    &quot;name&quot; =&gt; &quot;type_1_createdAt_-1&quot;,
  ),
  3 =&gt; array(
    &quot;v&quot; =&gt; 1,
    &quot;key&quot; =&gt; array(
      &quot;location&quot; =&gt; &quot;2d&quot;,
    ),
    &quot;ns&quot; =&gt; &quot;test.venues&quot;,
    &quot;name&quot; =&gt; &quot;location_2d&quot;,
  ),
)
</pre></div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongocollection.getindexinfo-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   MongoDB core docs on 
   <a href="http://docs.mongodb.org/manual/indexes/" class="link external">&raquo;&nbsp;vanilla indexes</a> and
   <a href="http://docs.mongodb.org/manual/applications/geospatial-indexes/" class="link external">&raquo;&nbsp;geospatial indexes</a>.
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongocollection.getdbref.html">MongoCollection::getDBRef</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongocollection.getname.html">MongoCollection::getName</a></div>
 <div class="up"><a href="class.mongocollection.html">MongoCollection</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>