/** * {@inheritdoc} */ public function purge() { if ($this->collection instanceof \MongoDB\Collection) { $this->collection->deleteMany(['expiration' => ['$lte' => time()]]); } else { $this->collection->remove(['expiration' => ['$lte' => time()]], ['multiple' => true]); } return true; }
/** * Delete a record from the database. * * @param mixed $id * @return int */ public function delete($id = null) { $wheres = $this->compileWheres(); $result = $this->collection->deleteMany($wheres); return $result->getDeletedCount(); // if (1 == (int) $result['ok']) // { // return $result['n']; // } // // return 0; }