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); }
/** * Wrapper method for MongoCollection::deleteIndexes(). * * @see http://php.net/manual/en/mongocollection.deleteindexes.php * @return array */ public function deleteIndexes() { return $this->mongoCollection->deleteIndexes(); }
<?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(); }
/** * deleteIndexes. */ public function deleteIndexes() { $this->time->start(); $return = parent::deleteIndexes(); $time = $this->time->stop(); $this->log(array('type' => 'deleteIndexes', 'time' => $time)); return $return; }
/** * @return array */ public function dropIndexes() { return $this->collection->deleteIndexes(); }