/**
  * Create every requested collection index.
  *
  * @throws \MongoException
  */
 public function createIndexes()
 {
     foreach ($this->getCollections() as $collection) {
         if (empty($indexes = $collection->getIndexes())) {
             continue;
         }
         $odmCollection = $this->odm->database($collection->getDatabase())->selectCollection($collection->getName());
         foreach ($indexes as $index) {
             $options = [];
             if (isset($index[DocumentEntity::INDEX_OPTIONS])) {
                 $options = $index[DocumentEntity::INDEX_OPTIONS];
                 unset($index[DocumentEntity::INDEX_OPTIONS]);
             }
             $odmCollection->createIndex($index, $options);
         }
     }
 }
 /**
  * @param FilesInterface $files
  * @param ODM            $odm
  * @param array          $options
  */
 public function __construct(FilesInterface $files, ODM $odm, array $options)
 {
     parent::__construct($files, $options);
     $this->database = $odm->database($this->options['database']);
 }
 /**
  * MongoDatabase instance.
  *
  * @return MongoDatabase
  */
 protected function mongoDatabase()
 {
     return $this->odm->database($this->database);
 }