public function createIndexes() { try { $this->collection->dropIndexes(); } catch (RuntimeException $e) { } $this->collection->createIndex(['timestamp' => 1], ['expireAfterSeconds' => 302]); $this->collection->createIndex(['sessionId' => 1], ['unique' => false]); }
/** * Delete all indexes for this collection * * @link http://www.php.net/manual/en/mongocollection.deleteindexes.php * @return array Returns the database response. */ public function deleteIndexes() { try { return TypeConverter::toLegacy($this->collection->dropIndexes()); } catch (\MongoDB\Driver\Exception\Exception $e) { return ExceptionConverter::toResultArray($e); } }
/** * Delete all indexes for this collection * * @link http://www.php.net/manual/en/mongocollection.deleteindexes.php * @return array Returns the database response. */ public function deleteIndexes() { return TypeConverter::toLegacy($this->collection->dropIndexes()); }