Commit fe60e9d5 authored by yujiwei's avatar yujiwei

update:xhprof 支持创建固定大小集合

parent 0c7c9af6
......@@ -99,6 +99,21 @@ abstract class MongoBase
);
}
$this->database = $this->client->selectDatabase($this->getDatabaseName());
// xhprof 需要 显示的创建固定大小的集合
$db_collection = [];
if ($this->getDatabaseName() === 'xhprof') {
foreach ($this->database->listCollections() as $item){
$db_collection[] = $item['name'];
}
if (!in_array($this->getCollectionName(), $db_collection, true)) {
//默认创建固定20GB大小的集合
$this->database->createCollection($this->getCollectionName(),['capped' => true,'size' => 21474836480]);
}
}
$this->collection = $this->database->selectCollection($this->getCollectionName(), $this->getCollectionOptions());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment