public function MongoFile::ensureIndices in One Click Upload 7.2
1 call to MongoFile::ensureIndices()
- MongoFile::saveChunk in flowphp/
src/ Flow/ Mongo/ MongoFile.php - Save chunk
File
- flowphp/
src/ Flow/ Mongo/ MongoFile.php, line 156
Class
- MongoFile
- Notes:
Namespace
Flow\MongoCode
public function ensureIndices() {
$chunksCollection = $this->config
->getGridFs()->chunks;
$indexKeys = [
'files_id' => 1,
'n' => 1,
];
$indexOptions = [
'unique' => true,
'background' => true,
];
if (method_exists($chunksCollection, 'createIndex')) {
// only available for PECL mongo >= 1.5.0
$chunksCollection
->createIndex($indexKeys, $indexOptions);
}
else {
$chunksCollection
->ensureIndex($indexKeys, $indexOptions);
}
}