Esempio n. 1
0
 /**
  * @todo http://php.net/manual/en/mongocollection.ensureindex.php
  * @param       $key
  * @param array $options
  * @return bool
  */
 public function addIndex($key, array $options = [])
 {
     foreach ($key as $id => $name) {
         if (is_numeric($id)) {
             unset($key[$id]);
             $key[$name] = 1;
         }
     }
     $options = array_merge($options, ['background' => 1]);
     $this->_connection->logging();
     return $this->_mongoCollection->ensureIndex($key, $options);
 }