deleteIndexes() public method

Delete all indexes for this collection
public deleteIndexes ( ) : array
return array Returns the database response.
Esempio n. 1
0
 function eliminarIndicesATablaTemporal($TABLA)
 {
     try {
         $DB = $this->CONEXION->innet;
         $COLECCION = new MongoCollection($DB, "temporal" . $TABLA);
         $COLECCION->deleteIndexes();
     } catch (Exception $e) {
         $this->LOG->registraLog("Generica", $e->getMessage(), "No es posible crear un indice " . $TABLA);
         return false;
     }
     return $DATOS["_id"];
 }
 public function testDeleteIndexes()
 {
     $idx = $this->object->db->selectCollection('system.indexes');
     $this->object->ensureIndex(array('foo' => 1));
     $this->object->ensureIndex(array('foo' => -1));
     $this->object->ensureIndex(array('bar' => 1, 'baz' => -1));
     $num = iterator_count($idx->find(array('ns' => 'phpunit.c')));
     $this->assertEquals($num, 4);
     $this->object->deleteIndexes();
     $num = iterator_count($idx->find(array('ns' => 'phpunit.c')));
     $this->assertEquals($num, 1);
 }
Esempio n. 3
0
 /**
  * Wrapper method for MongoCollection::deleteIndexes().
  *
  * @see http://php.net/manual/en/mongocollection.deleteindexes.php
  * @return array
  */
 public function deleteIndexes()
 {
     return $this->mongoCollection->deleteIndexes();
 }
Esempio n. 4
0
<?php

error_reporting(E_ALL);
// connect
$m = new MongoClient();
// select a database
$db = $m->selectDB('trend');
// select a collection (analogous to a relational database's table)
$colnames = ['housesale', 'aptsale', 'flatsale', 'houserent', 'aptrent', 'flatrent'];
foreach ($colnames as $colname) {
    echo "Removing {$colname}...\n";
    $col = new MongoCollection($db, $colname);
    $col->drop();
    $col->deleteIndexes();
    $col2name = $colname . "_agg";
    $col2 = new MongoCollection($db, $col2name);
    $col2->drop();
    $col2->deleteIndexes();
}
Esempio n. 5
0
 /**
  * deleteIndexes.
  */
 public function deleteIndexes()
 {
     $this->time->start();
     $return = parent::deleteIndexes();
     $time = $this->time->stop();
     $this->log(array('type' => 'deleteIndexes', 'time' => $time));
     return $return;
 }
Esempio n. 6
0
 /**
  * @return array
  */
 public function dropIndexes()
 {
     return $this->collection->deleteIndexes();
 }