Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 9959

php-manual-en-7.2.11-1.mga7.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="mongocollection.distinct.basic-embedded">
   <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(4) {
  [0]=&gt;
  array(4) {
    [&quot;v&quot;]=&gt;
    int(1)
    [&quot;key&quot;]=&gt;
    array(1) {
      [&quot;_id&quot;]=&gt;
      int(1)
    }
    [&quot;name&quot;]=&gt;
    string(4) &quot;_id_&quot;
    [&quot;ns&quot;]=&gt;
    string(11) &quot;test.venues&quot;
  }
  [1]=&gt;
  array(4) {
    [&quot;v&quot;]=&gt;
    int(1)
    [&quot;key&quot;]=&gt;
    array(1) {
      [&quot;name&quot;]=&gt;
      float(1)
    }
    [&quot;name&quot;]=&gt;
    string(6) &quot;name_1&quot;
    [&quot;ns&quot;]=&gt;
    string(11) &quot;test.venues&quot;
  }
  [2]=&gt;
  array(4) {
    [&quot;v&quot;]=&gt;
    int(1)
    [&quot;key&quot;]=&gt;
    array(2) {
      [&quot;type&quot;]=&gt;
      float(1)
      [&quot;createdAt&quot;]=&gt;
      float(-1)
    }
    [&quot;name&quot;]=&gt;
    string(19) &quot;type_1_createdAt_-1&quot;
    [&quot;ns&quot;]=&gt;
    string(11) &quot;test.venues&quot;
  }
  [3]=&gt;
  array(5) {
    [&quot;v&quot;]=&gt;
    int(1)
    [&quot;key&quot;]=&gt;
    array(1) {
      [&quot;location&quot;]=&gt;
      string(8) &quot;2dsphere&quot;
    }
    [&quot;name&quot;]=&gt;
    string(17) &quot;location_2dsphere&quot;
    [&quot;ns&quot;]=&gt;
    string(11) &quot;test.venues&quot;
    [&quot;2dsphereIndexVersion&quot;]=&gt;
    int(2)
  }
}
</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="https://docs.mongodb.com/manual/indexes/" class="link external">&raquo;&nbsp;vanilla indexes</a> and
   <a href="https://docs.mongodb.com/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>