You are here

function _mongodb_block_ensure_indexes in MongoDB 7

Create indexes for mongo blocks.

Parameters

array $theme_list: Array of themes to create indexes for.

Throws

\MongoConnectionException

2 calls to _mongodb_block_ensure_indexes()
mongodb_block_themes_enabled in mongodb_block/mongodb_block.module
Implements hook_themes_enabled().
_mongodb_block_ensure_all_indexes in mongodb_block/mongodb_block.install
Ensure indexes to block collections for enabled themes.

File

mongodb_block/mongodb_block.module, line 22
Controls the visual building blocks a page is constructed with.

Code

function _mongodb_block_ensure_indexes(array $theme_list) {
  foreach ($theme_list as $theme) {
    $index = [
      '_id.module' => 1,
      '_id.delta' => 1,
    ];
    mongodb_collection('block', $theme)
      ->ensureIndex($index);
    mongodb_collection('block_customized', $theme)
      ->ensureIndex($index);
  }
}